public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Patch to handle cgroup and btrfs filesystems
@ 2010-10-01  4:33 Andreas Jaeger
  2010-10-01 15:26 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Jaeger @ 2010-10-01  4:33 UTC (permalink / raw)
  To: libc-hacker

Here's a patch to handle btrfs and cgroup on Linux,
Andreas

2010-09-30  Andreas Jaeger  <aj@suse.de>

	* sysdeps/unix/sysv/linux_fsinfo.h (BTRFS_SUPER_MAGIC): Define.
	(CGROUP_SUPER_MAGIC): Define.

	* sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags):
	Handle btrfs and cgroup file systems.
	* sysdeps/unix/sysv/linux/pathconf.c (__statfs_filesize_max):
	Likewise.

diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c 
b/sysdeps/unix/sysv/linux/internal_statvfs.c
index 0169ae3..aefaf2a 100644
--- a/sysdeps/unix/sysv/linux/internal_statvfs.c
+++ b/sysdeps/unix/sysv/linux/internal_statvfs.c
@@ -109,6 +109,12 @@ __statvfs_getflags (const char *name, int fstype, 
struct stat64 *st)
     case LOGFS_MAGIC_U32:
       fsname = "logfs";
       break;
+    case BTRFS_SUPER_MAGIC:
+      fsname = "btrfs";
+      break;
+    case CGROUP_SUPER_MAGIC:
+      fsname = "cgroup";
+      break;
     }
 
   FILE *mtab = __setmntent ("/proc/mounts", "r");
diff --git a/sysdeps/unix/sysv/linux/linux_fsinfo.h 
b/sysdeps/unix/sysv/linux/linux_fsinfo.h
index b10e98b..8efbdea 100644
--- a/sysdeps/unix/sysv/linux/linux_fsinfo.h
+++ b/sysdeps/unix/sysv/linux/linux_fsinfo.h
@@ -23,7 +23,7 @@
 /* These definitions come from the kernel headers.  But we cannot
    include the headers here because of type clashes.  If new
    filesystem types will become available we have to add the
-   appropriate definitions here.*/
+   appropriate definitions here.  */
 
 /* Constant that identifies the `adfs' filesystem.  */
 #define ADFS_SUPER_MAGIC	0xadf5
@@ -37,6 +37,12 @@
 /* Constant that identifies the `bfs' filesystem.  */
 #define BFS_MAGIC		0x1BADFACE
 
+/* Constant that identifies the `btrfs' filesystem.  */
+#define BTRFS_SUPER_MAGIC	0x1BADFACE
+
+/* Constant that identifies the `cgroup' filesystem.  */
+#define CGROUP_SUPER_MAGIC	0x1BADFACE
+
 /* Constant that identifies the `coda' filesystem.  */
 #define CODA_SUPER_MAGIC	0x73757245
 
diff --git a/sysdeps/unix/sysv/linux/pathconf.c 
b/sysdeps/unix/sysv/linux/pathconf.c
index db03529..ae597fb 100644
--- a/sysdeps/unix/sysv/linux/pathconf.c
+++ b/sysdeps/unix/sysv/linux/pathconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 1991,1995,1996,1998-2003,2008 Free Software Foundation, 
Inc.
+   Copyright (C) 1991,1995,1996,1998-2003,2008,2010 Free Software 
Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -126,6 +126,9 @@ __statfs_filesize_max (int result, const struct statfs 
*fsbuf)
 
   switch (fsbuf->f_type)
     {
+    case BTRFS_SUPER_MAGIC:
+      return 255;
+
     case EXT2_SUPER_MAGIC:
     case UFS_MAGIC:
     case UFS_CIGAM:
@@ -136,6 +139,7 @@ __statfs_filesize_max (int result, const struct statfs 
*fsbuf)
     case UDF_SUPER_MAGIC:
     case JFS_SUPER_MAGIC:
     case VXFS_SUPER_MAGIC:
+    case CGROUP_SUPER_MAGIC:
       return 64;
 
     case MSDOS_SUPER_MAGIC:

-- 
 Andreas Jaeger, Program Manager openSUSE,  aj@{novell.com,opensuse.org}
  Twitter: jaegerandi | Identica: jaegerandi
   SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
    Maxfeldstr. 5, 90409 Nürnberg, Germany
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

-- 
 Andreas Jaeger, Program Manager openSUSE,  aj@{novell.com,opensuse.org}
  Twitter: jaegerandi | Identica: jaegerandi
   SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
    Maxfeldstr. 5, 90409 Nürnberg, Germany
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch to handle cgroup and btrfs filesystems
  2010-10-01  4:33 Patch to handle cgroup and btrfs filesystems Andreas Jaeger
@ 2010-10-01 15:26 ` Richard Henderson
  2010-10-01 19:49   ` Andreas Jaeger
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2010-10-01 15:26 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: libc-hacker

On 09/30/2010 09:32 PM, Andreas Jaeger wrote:
>  /* Constant that identifies the `bfs' filesystem.  */
>  #define BFS_MAGIC		0x1BADFACE
>  
> +/* Constant that identifies the `btrfs' filesystem.  */
> +#define BTRFS_SUPER_MAGIC	0x1BADFACE
> +
> +/* Constant that identifies the `cgroup' filesystem.  */
> +#define CGROUP_SUPER_MAGIC	0x1BADFACE

3 identical magic's can't be put into the same switch
statements.  How did this compile for you?


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch to handle cgroup and btrfs filesystems
  2010-10-01 15:26 ` Richard Henderson
@ 2010-10-01 19:49   ` Andreas Jaeger
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Jaeger @ 2010-10-01 19:49 UTC (permalink / raw)
  To: Richard Henderson; +Cc: libc-hacker

On Friday 01 October 2010 17:26:28 Richard Henderson wrote:
> On 09/30/2010 09:32 PM, Andreas Jaeger wrote:
> >  /* Constant that identifies the `bfs' filesystem.  */
> >  #define BFS_MAGIC		0x1BADFACE
> > 
> > +/* Constant that identifies the `btrfs' filesystem.  */
> > +#define BTRFS_SUPER_MAGIC	0x1BADFACE
> > +
> > +/* Constant that identifies the `cgroup' filesystem.  */
> > +#define CGROUP_SUPER_MAGIC	0x1BADFACE
> 
> 3 identical magic's can't be put into the same switch
> statements.  How did this compile for you?

I tested the wrong tree, not sure how emacs tricked me, I copied the values ;-(

thanks for noticing, here's the fix.  This time tested with the right tree,
Andreas

2010-10-01  Andreas Jaeger  <aj@suse.de>

	* sysdeps/unix/sysv/linux/linux_fsinfo.h (BTRFS_SUPER_MAGIC): Fix value.
	(CGROUP_SUPER_MAGIC): Likewise.

diff --git a/sysdeps/unix/sysv/linux/linux_fsinfo.h b/sysdeps/unix/sysv/linux/linux_fsinfo.h
index 8efbdea..b671d2c 100644
--- a/sysdeps/unix/sysv/linux/linux_fsinfo.h
+++ b/sysdeps/unix/sysv/linux/linux_fsinfo.h
@@ -38,10 +38,10 @@
 #define BFS_MAGIC		0x1BADFACE
 
 /* Constant that identifies the `btrfs' filesystem.  */
-#define BTRFS_SUPER_MAGIC	0x1BADFACE
+#define BTRFS_SUPER_MAGIC	0x9123683E
 
 /* Constant that identifies the `cgroup' filesystem.  */
-#define CGROUP_SUPER_MAGIC	0x1BADFACE
+#define CGROUP_SUPER_MAGIC	0x27e0eb
 
 /* Constant that identifies the `coda' filesystem.  */
 #define CODA_SUPER_MAGIC	0x73757245


-- 
 Andreas Jaeger, Program Manager openSUSE,  aj@{novell.com,opensuse.org}
  Twitter: jaegerandi | Identica: jaegerandi
   SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
    Maxfeldstr. 5, 90409 Nürnberg, Germany
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-01 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-01  4:33 Patch to handle cgroup and btrfs filesystems Andreas Jaeger
2010-10-01 15:26 ` Richard Henderson
2010-10-01 19:49   ` Andreas Jaeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).