xfs
[Top] [All Lists]

Re: [DMAPI] code error in dm_ip_to_handle()

To: Aurelien Degremont - Stagiaire <degremont@xxxxxxxxxxx>
Subject: Re: [DMAPI] code error in dm_ip_to_handle()
From: Dean Roehrich <roehrich@xxxxxxx>
Date: Mon, 16 May 2005 14:52:40 -0500
Cc: linux-xfs@xxxxxxxxxxx
Sender: linux-xfs-bounce@xxxxxxxxxxx
>From:  Aurelien Degremont - Stagiaire <degremont@xxxxxxxxxxx>

>Here is a very small patch that change the parameter of fh_to_inode() 
>and inode_to_fh().
>I just replace the dm_fsfid_t by a dm_fid_t.

I've been using your patch today.  So far it's good.

Here's the rest of it, to completely remove dm_fsfid.  Do these
dm_copyin_handle() changes look right to you?

Dean


Index: lbs-a/linux/linux/fs/dmapi/dmapi.h
===================================================================
--- lbs-a.orig/linux/linux/fs/dmapi/dmapi.h     2005-04-26 16:43:14.000000000 
-0700
+++ lbs-a/linux/linux/fs/dmapi/dmapi.h  2005-05-16 08:41:52.000000000 -0700
@@ -482,11 +482,6 @@ typedef struct dm_xstat dm_xstat_t;
 
 #define MAXDMFSFIDSZ   46
 
-typedef struct dm_fsfid {
-       __u16           fid_len;                /* length of data in bytes */
-       unsigned char   fid_data[MAXDMFSFIDSZ]; /* data (fid_len worth)  */
-} dm_fsfid_t;
-
 struct dm_fid {
        __u16   dm_fid_len;             /* length of remainder  */
        __u16   dm_fid_pad;
Index: lbs-a/linux/linux/fs/dmapi/dmapi_right.c
===================================================================
--- lbs-a.orig/linux/linux/fs/dmapi/dmapi_right.c       2005-04-26 
13:36:49.000000000 -0700
+++ lbs-a/linux/linux/fs/dmapi/dmapi_right.c    2005-05-16 08:45:58.000000000 
-0700
@@ -51,29 +51,27 @@ dm_copyin_handle(
        dm_handle_t     *handlep)       /* output, copy of data */
 {
        u_short         len;
-       dm_fsfid_t      *fidp;
+       dm_fid_t        *fidp;
 
-       fidp = (dm_fsfid_t*)&handlep->ha_fid;
+       fidp = (dm_fid_t*)&handlep->ha_fid;
 
        if (hlen < sizeof(handlep->ha_fsid) || hlen > sizeof(*handlep))
-               return(-EBADF);
+               return -EBADF;
 
        if (copy_from_user(handlep, hanp, hlen))
-               return(-EFAULT);
+               return -EFAULT;
 
        if (hlen < sizeof(*handlep))
                memset((char *)handlep + hlen, 0, sizeof(*handlep) - hlen);
 
        if (hlen == sizeof(handlep->ha_fsid))
-               return(0);      /* FS handle, nothing more to check */
+               return 0;       /* FS handle, nothing more to check */
 
-       len = hlen - sizeof(handlep->ha_fsid) - sizeof(fidp->fid_len);
+       len = hlen - sizeof(handlep->ha_fsid) - sizeof(fidp->dm_fid_len);
 
-       if (fidp->fid_len != len ||
-           *((short *) fidp->fid_data)) {
-               return(-EBADF);
-       }
-       return(0);
+       if ((fidp->dm_fid_len != len) || fidp->dm_fid_pad)
+               return -EBADF;
+       return 0;
 }
 
 /* Allocate and initialize a tevp structure.  Called from both application and


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