xfs
[Top] [All Lists]

Re: xfsprogs patch for evms

To: Luciano Chavez <lnx1138@xxxxxxxxxx>
Subject: Re: xfsprogs patch for evms
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 1 Aug 2002 16:15:12 +0100
Cc: linux-xfs@xxxxxxxxxxx, lord@xxxxxxx
In-reply-to: <1028213377.16184.77.camel@chavez>; from lnx1138@xxxxxxxxxx on Thu, Aug 01, 2002 at 09:49:36AM -0500
References: <1028213377.16184.77.camel@chavez>
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
+ * 
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software 
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Module: evms.c

Urgg, could you remove thise Module: junk?  I had to fight that in JFS already..

+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <asm/errno.h>

DON'T include kernel headers from userspace.  Please use <errno.h> instead.

+#include <volume.h>
+#include "evms.h"
+
+int
+mnt_is_evms_subvol(dev_t dev)
+{
+       if (dev >> 8 == EVMS_MAJOR)

Please use major() from <sys/sysmacros.h> instead.  Userspace dev_t
is 16bit on libc4/libc5 systems and 64bit on glibc systems.  I guess
uclibc/dietlibc use something small, too.

+static int
+get_stripe_info(int fd, evms_vol_stripe_info_t *info)
+{
+        int rc = 0;
+       int status;
+
+       status = ioctl(fd, EVMS_GET_VOL_STRIPE_INFO, info);
+       if (status) {
+                rc = errno;
+       }
+       return(rc);

What about:

if (ioctl(fd, EVMS_GET_VOL_STRIPE_INFO, info))
        return errno;
return 0;

instead? much easier to parse.


+ * Module: evms.h

Dito.

+#include <linux/hdreg.h>
+#include <linux/major.h>

Kernel header _again_.  What do you actually need them for?


<Prev in Thread] Current Thread [Next in Thread>