Re: LFS 'posix locking' syscall modifications

From: Trond Myklebust (trond.myklebust@fys.uio.no)
Date: Sun Apr 09 2000 - 17:03:06 EST


>>>>> " " == Trond Myklebust <trond.myklebust@fys.uio.no> writes:

> Hi,

> The following is an alternative proposal to Andrea's
> patch. It's
> advantage is that it eliminates the ugly copying between
> 'struct flock64' and 'struct flock'. (These 2 structures are
> after all only user interfaces to the 'struct
> file_lock'). Separating the code for these 2 interfaces has the
> added benefit that we can correctly treat integer overflows
> that can result.

Oops. The previous patch contained a small misunderstanding w.r.t. the
LFS standard (viz. overflow errors due to calling the posix getlk() on
an LFS-sized lock). The following should be correct.

Cheers,
  Trond

diff -u --recursive --new-file linux-2.3.99-pre4-4/fs/fcntl.c linux-2.3.99-pre4-locks/fs/fcntl.c
--- linux-2.3.99-pre4-4/fs/fcntl.c Sun Feb 27 05:46:44 2000
+++ linux-2.3.99-pre4-locks/fs/fcntl.c Sat Apr 8 21:50:00 2000
@@ -207,14 +207,25 @@
                         err = setfl(fd, filp, arg);
                         break;
                 case F_GETLK:
- err = fcntl_getlk(fd, (struct flock *) arg);
+ err = fcntl_getlk(fd, (flock_t *) arg);
                         break;
                 case F_SETLK:
- err = fcntl_setlk(fd, cmd, (struct flock *) arg);
+ err = fcntl_setlk(fd, cmd, (flock_t *) arg);
                         break;
                 case F_SETLKW:
- err = fcntl_setlk(fd, cmd, (struct flock *) arg);
+ err = fcntl_setlk(fd, cmd, (flock_t *) arg);
                         break;
+#ifndef __alpha__
+ case F_GETLK_EXT:
+ err = extended_getlk(fd, (lflock_t *) arg);
+ break;
+ case F_SETLK_EXT:
+ err = extended_setlk(fd, cmd, (lflock_t *) arg);
+ break;
+ case F_SETLKW_EXT:
+ err = extended_setlk(fd, cmd, (lflock_t *) arg);
+ break;
+#endif
                 case F_GETOWN:
                         /*
                          * XXX If f_owner is a process group, the
diff -u --recursive --new-file linux-2.3.99-pre4-4/fs/locks.c linux-2.3.99-pre4-locks/fs/locks.c
--- linux-2.3.99-pre4-4/fs/locks.c Thu Apr 6 23:55:12 2000
+++ linux-2.3.99-pre4-locks/fs/locks.c Sun Apr 9 23:29:33 2000
@@ -113,8 +113,12 @@
 
 static int flock_make_lock(struct file *filp, struct file_lock *fl,
                                unsigned int cmd);
-static int posix_make_lock(struct file *filp, struct file_lock *fl,
- struct flock *l);
+static int posix_make_lock(struct file *filp, struct file_lock *fl, flock_t *l);
+
+#ifndef __alpha__
+static int extended_make_lock(struct file *filp, struct file_lock *fl,
+ lflock_t *l);
+#endif
 static int flock_locks_conflict(struct file_lock *caller_fl,
                                 struct file_lock *sys_fl);
 static int posix_locks_conflict(struct file_lock *caller_fl,
@@ -314,14 +318,34 @@
         return (error);
 }
 
+static
+struct file_lock *do_getlk(struct file *filp, struct file_lock *file_lock)
+{
+ struct file_lock *fl;
+
+ if (filp->f_op->lock) {
+ int error = filp->f_op->lock(filp, F_GETLK, file_lock);
+ if (error < 0)
+ return ERR_PTR(error);
+ else if (error == LOCK_USE_CLNT)
+ /* Bypass for NFS with no locking - 2.0.36 compat */
+ fl = posix_test_lock(filp, file_lock);
+ else
+ fl = (file_lock->fl_type == F_UNLCK ? NULL : file_lock);
+ } else
+ fl = posix_test_lock(filp, file_lock);
+
+ return fl;
+}
+
 /* Report the first existing lock that would conflict with l.
  * This implements the F_GETLK command of fcntl().
  */
-int fcntl_getlk(unsigned int fd, struct flock *l)
+int fcntl_getlk(unsigned int fd, flock_t *l)
 {
         struct file *filp;
         struct file_lock *fl,file_lock;
- struct flock flock;
+ flock_t flock;
         int error;
 
         error = -EFAULT;
@@ -336,24 +360,24 @@
         if (!filp)
                 goto out;
 
- if (!posix_make_lock(filp, &file_lock, &flock))
+ error = posix_make_lock(filp, &file_lock, &flock);
+ if (error < 0)
                 goto out_putf;
 
- if (filp->f_op->lock) {
- error = filp->f_op->lock(filp, F_GETLK, &file_lock);
- if (error < 0)
- goto out_putf;
- else if (error == LOCK_USE_CLNT)
- /* Bypass for NFS with no locking - 2.0.36 compat */
- fl = posix_test_lock(filp, &file_lock);
- else
- fl = (file_lock.fl_type == F_UNLCK ? NULL : &file_lock);
- } else {
- fl = posix_test_lock(filp, &file_lock);
+ fl = do_getlk(filp, &file_lock);
+ if (fl != NULL && IS_ERR(fl)) {
+ error = PTR_ERR(error);
+ goto out_putf;
         }
  
         flock.l_type = F_UNLCK;
         if (fl != NULL) {
+ /* Are we looking at an LFS lock? */
+ error = -EOVERFLOW;
+ if (fl->fl_start > INT_LIMIT(off_t))
+ goto out_putf;
+ if (fl->fl_end > INT_LIMIT(off_t) && fl->fl_end != OFFSET_MAX)
+ goto out_putf;
                 flock.l_pid = fl->fl_pid;
                 flock.l_start = fl->fl_start;
                 flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
@@ -371,34 +395,64 @@
         return error;
 }
 
-/* Apply the lock described by l to an open file descriptor.
- * This implements both the F_SETLK and F_SETLKW commands of fcntl().
- */
-int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l)
+
+#ifndef __alpha__
+int extended_getlk(unsigned int fd, lflock_t *l)
 {
         struct file *filp;
- struct file_lock file_lock;
- struct flock flock;
- struct inode *inode;
+ struct file_lock *fl,file_lock;
+ lflock_t flock;
         int error;
 
- /*
- * This might block, so we do it before checking the inode.
- */
         error = -EFAULT;
         if (copy_from_user(&flock, l, sizeof(flock)))
                 goto out;
-
- /* Get arguments and validate them ...
- */
+ error = -EINVAL;
+ if ((flock.l_type != F_RDLCK) && (flock.l_type != F_WRLCK))
+ goto out;
 
         error = -EBADF;
         filp = fget(fd);
         if (!filp)
                 goto out;
 
- error = -EINVAL;
- inode = filp->f_dentry->d_inode;
+ error = extended_make_lock(filp, &file_lock, &flock);
+ if (error < 0)
+ goto out_putf;
+
+ fl = do_getlk(filp, &file_lock);
+ if (fl != NULL && IS_ERR(fl)) {
+ error = PTR_ERR(error);
+ goto out_putf;
+ }
+
+ flock.l_type = F_UNLCK;
+ if (fl != NULL) {
+ flock.l_pid = fl->fl_pid;
+ flock.l_pid = fl->fl_pid;
+ flock.l_start = fl->fl_start;
+ flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
+ fl->fl_end - fl->fl_start + 1;
+ flock.l_whence = 0;
+ flock.l_type = fl->fl_type;
+ }
+ error = -EFAULT;
+ if (!copy_to_user(l, &flock, sizeof(flock)))
+ error = 0;
+
+out_putf:
+ fput(filp);
+out:
+ return error;
+}
+#endif
+
+static
+int do_setlk(struct file *filp, struct file_lock *file_lock,
+ unsigned int cmd, int l_type)
+{
+ struct inode *inode = filp->f_dentry->d_inode;
+ int error = -EINVAL;
 
         /* Don't allow mandatory locks on files that may be memory mapped
          * and shared.
@@ -413,24 +467,20 @@
                                 continue;
                         spin_unlock(&mapping->i_shared_lock);
                         error = -EAGAIN;
- goto out_putf;
+ goto out;
                 }
                 spin_unlock(&mapping->i_shared_lock);
         }
 
- error = -EINVAL;
- if (!posix_make_lock(filp, &file_lock, &flock))
- goto out_putf;
-
         error = -EBADF;
- switch (flock.l_type) {
+ switch (l_type) {
         case F_RDLCK:
                 if (!(filp->f_mode & FMODE_READ))
- goto out_putf;
+ goto out;
                 break;
         case F_WRLCK:
                 if (!(filp->f_mode & FMODE_WRITE))
- goto out_putf;
+ goto out;
                 break;
         case F_UNLCK:
                 break;
@@ -448,26 +498,94 @@
         }
 }
                 if (!(filp->f_mode & 3))
- goto out_putf;
+ goto out;
                 break;
 #endif
         default:
                 error = -EINVAL;
- goto out_putf;
+ goto out;
         }
 
         if (filp->f_op->lock != NULL) {
- error = filp->f_op->lock(filp, cmd, &file_lock);
+ error = filp->f_op->lock(filp, cmd, file_lock);
                 if (error < 0)
- goto out_putf;
+ goto out;
         }
- error = posix_lock_file(filp, &file_lock, cmd == F_SETLKW);
+ error = posix_lock_file(filp, file_lock, cmd == F_SETLKW);
+ out:
+ return error;
+}
 
+/* Apply the lock described by l to an open file descriptor.
+ * This implements both the F_SETLK and F_SETLKW commands of fcntl().
+ */
+int fcntl_setlk(unsigned int fd, unsigned int cmd, flock_t *l)
+{
+ struct file *filp;
+ struct file_lock file_lock;
+ flock_t flock;
+ int error;
+
+ /*
+ * This might block, so we do it before checking the inode.
+ */
+ error = -EFAULT;
+ if (copy_from_user(&flock, l, sizeof(flock)))
+ goto out;
+
+ /* Get arguments and validate them ...
+ */
+
+ error = -EBADF;
+ filp = fget(fd);
+ if (!filp)
+ goto out;
+
+ error = posix_make_lock(filp, &file_lock, &flock);
+ if (error < 0)
+ goto out_putf;
+
+ error = do_setlk(filp, &file_lock, cmd, flock.l_type);
+out_putf:
+ fput(filp);
+out:
+ return error;
+}
+
+#ifndef __alpha__
+int extended_setlk(unsigned int fd, unsigned int cmd, lflock_t *l)
+{
+ struct file *filp;
+ struct file_lock file_lock;
+ lflock_t flock;
+ int error;
+
+ /*
+ * This might block, so we do it before checking the inode.
+ */
+ error = -EFAULT;
+ if (copy_from_user(&flock, l, sizeof(flock)))
+ goto out;
+
+ /* Get arguments and validate them ...
+ */
+
+ error = -EBADF;
+ filp = fget(fd);
+ if (!filp)
+ goto out;
+
+ error = extended_make_lock(filp, &file_lock, &flock);
+ if (error < 0)
+ goto out_putf;
+
+ error = do_setlk(filp, &file_lock, cmd, flock.l_type);
 out_putf:
         fput(filp);
 out:
         return error;
 }
+#endif
 
 /*
  * This function is called when the file is being removed
@@ -638,9 +756,10 @@
  * style lock.
  */
 static int posix_make_lock(struct file *filp, struct file_lock *fl,
- struct flock *l)
+ flock_t *l)
 {
- loff_t start;
+ int error = -EINVAL;
+ off_t start, end;
 
         memset(fl, 0, sizeof(*fl));
         
@@ -654,7 +773,7 @@
                 fl->fl_type = l->l_type;
                 break;
         default:
- return (0);
+ goto out;
         }
 
         switch (l->l_whence) {
@@ -668,24 +787,83 @@
                 start = filp->f_dentry->d_inode->i_size;
                 break;
         default:
- return (0);
+ goto out;
         }
 
         if (((start += l->l_start) < 0) || (l->l_len < 0))
- return (0);
- fl->fl_end = start + l->l_len - 1;
- if (l->l_len > 0 && fl->fl_end < 0)
- return (0);
+ goto out;
+ end = start + l->l_len - 1;
+ if (l->l_len > 0 && end < 0)
+ goto out;
         fl->fl_start = start; /* we record the absolute position */
         if (l->l_len == 0)
                 fl->fl_end = OFFSET_MAX;
+ else
+ fl->fl_end = end;
         
         fl->fl_file = filp;
         fl->fl_owner = current->files;
         fl->fl_pid = current->pid;
+ error = 0;
+ out:
+ return error;
+}
+
+#ifndef __alpha__
+static int extended_make_lock(struct file *filp, struct file_lock *fl,
+ lflock_t *l)
+{
+ int error = -EINVAL;
+ loff_t start, end;
+
+ memset(fl, 0, sizeof(*fl));
+
+ init_waitqueue_head(&fl->fl_wait);
+ fl->fl_flags = FL_POSIX;
 
- return (1);
+ switch (l->l_type) {
+ case F_RDLCK:
+ case F_WRLCK:
+ case F_UNLCK:
+ fl->fl_type = l->l_type;
+ break;
+ default:
+ goto out;
+ }
+
+ switch (l->l_whence) {
+ case 0: /*SEEK_SET*/
+ start = 0;
+ break;
+ case 1: /*SEEK_CUR*/
+ start = filp->f_pos;
+ break;
+ case 2: /*SEEK_END*/
+ start = filp->f_dentry->d_inode->i_size;
+ break;
+ default:
+ goto out;
+ }
+
+ if (((start += l->l_start) < 0) || (l->l_len < 0))
+ goto out;
+ end = start + l->l_len - 1;
+ if (l->l_len > 0 && end < 0)
+ goto out;
+ fl->fl_start = start; /* we record the absolute position */
+ if (l->l_len == 0)
+ fl->fl_end = OFFSET_MAX;
+ else
+ fl->fl_end = end;
+
+ fl->fl_file = filp;
+ fl->fl_owner = current->files;
+ fl->fl_pid = current->pid;
+ error = 0;
+ out:
+ return error;
 }
+#endif
 
 /* Verify a call to flock() and fill in a file_lock structure with
  * an appropriate FLOCK lock.
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-alpha/fcntl.h linux-2.3.99-pre4-locks/include/asm-alpha/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-alpha/fcntl.h Fri Jan 7 01:17:19 2000
+++ linux-2.3.99-pre4-locks/include/asm-alpha/fcntl.h Sat Apr 8 21:45:48 2000
@@ -36,6 +36,10 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 7 /* Mapped to F_GETLK */
+#define F_SETLK64 8 /* Mapped to F_SETLK */
+#define F_SETLKW64 9 /* Mapped to F_SETLKW */
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -62,5 +66,17 @@
         __kernel_off_t l_len;
         __kernel_pid_t l_pid;
 };
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ __kernel_off_t l_start;
+ __kernel_off_t l_len;
+ __kernel_pid_t l_pid;
+};
+
+#ifdef __KERNEL__
+typedef struct flock flock_t;
+#endif
 
 #endif
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-arm/fcntl.h linux-2.3.99-pre4-locks/include/asm-arm/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-arm/fcntl.h Fri Dec 10 23:56:08 1999
+++ linux-2.3.99-pre4-locks/include/asm-arm/fcntl.h Sat Apr 8 21:38:00 2000
@@ -38,6 +38,9 @@
 #define F_GETLK64 12 /* using 'struct flock64' */
 #define F_SETLK64 13
 #define F_SETLKW64 14
+#define F_GETLK_EXT 12 /* using 'struct flock_lfs' */
+#define F_SETLK_EXT 13
+#define F_SETLKW_EXT 14
 
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
@@ -73,5 +76,18 @@
         loff_t l_len;
         pid_t l_pid;
 };
+
+struct flock_lfs {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#ifdef __KERNEL__
+typedef struct flock flock_t;
+typedef struct flock_lfs lflock_t;
+#endif
 
 #endif
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-i386/fcntl.h linux-2.3.99-pre4-locks/include/asm-i386/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-i386/fcntl.h Tue Dec 14 09:53:27 1999
+++ linux-2.3.99-pre4-locks/include/asm-i386/fcntl.h Sat Apr 8 21:38:17 2000
@@ -35,6 +35,14 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 12 /* using 'struct flock64' */
+#define F_SETLK64 13
+#define F_SETLKW64 14
+
+#define F_GETLK_EXT 12 /* using 'struct flock_lfs' */
+#define F_SETLK_EXT 13
+#define F_SETLKW_EXT 14
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -61,5 +69,26 @@
         off_t l_len;
         pid_t l_pid;
 };
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+struct flock_lfs {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#ifdef __KERNEL__
+typedef struct flock flock_t;
+typedef struct flock_lfs lflock_t;
+#endif /* __KERNEL__ */
 
 #endif
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-ia64/fcntl.h linux-2.3.99-pre4-locks/include/asm-ia64/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-ia64/fcntl.h Mon Feb 7 03:42:40 2000
+++ linux-2.3.99-pre4-locks/include/asm-ia64/fcntl.h Sat Apr 8 21:46:26 2000
@@ -43,6 +43,14 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 5
+#define F_SETLK64 6
+#define F_SETLKW64 7
+
+#define F_GETLK_EXT 12
+#define F_SETLK_EXT 13
+#define F_SETLKW_EXT 14
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -69,5 +77,26 @@
         off_t l_len;
         pid_t l_pid;
 };
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+struct flock_lfs {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#ifdef __KERNEL__
+typedef struct flock flock_t;
+typedef struct flock_lfs lflock_t;
+#endif /* __KERNEL__ */
 
 #endif /* _ASM_IA64_FCNTL_H */
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-m68k/fcntl.h linux-2.3.99-pre4-locks/include/asm-m68k/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-m68k/fcntl.h Wed Jan 26 21:44:21 2000
+++ linux-2.3.99-pre4-locks/include/asm-m68k/fcntl.h Sat Apr 8 21:46:46 2000
@@ -35,6 +35,13 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 12
+#define F_SETLK64 13
+#define F_SETLKW64 14
+#define F_GETLK_EXT 12
+#define F_SETLK_EXT 13
+#define F_SETLKW_EXT 14
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -61,5 +68,26 @@
         off_t l_len;
         pid_t l_pid;
 };
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+struct flock_lfs {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#ifdef __KERNEL__
+typedef struct flock flock_t;
+typedef struct flock_lfs lflock_t;
+#endif /* __KERNEL__ */
 
 #endif /* _M68K_FCNTL_H */
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-mips/fcntl.h linux-2.3.99-pre4-locks/include/asm-mips/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-mips/fcntl.h Fri Feb 25 07:52:30 2000
+++ linux-2.3.99-pre4-locks/include/asm-mips/fcntl.h Sat Apr 8 21:39:17 2000
@@ -44,6 +44,14 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 30 /* using 'struct flock64' */
+#define F_SETLK64 31
+#define F_SETLKW64 32
+
+#define F_GETLK_EXT 30 /* using 'struct flock_lfs' */
+#define F_SETLK_EXT 31
+#define F_SETLKW_EXT 32
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -72,5 +80,29 @@
         __kernel_pid_t l_pid;
         long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
 } flock_t;
+
+typedef struct flock64 {
+ short l_type;
+ short l_whence;
+ __kernel_loff_t l_start;
+ __kernel_loff_t l_len;
+ long l_sysid; /* XXXXXXXXXXXXXXXXXXXXXXXXX */
+ __kernel_pid_t l_pid;
+ long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
+};
+
+typedef struct flock_lfs {
+ short l_type;
+ short l_whence;
+ __kernel_loff_t l_start;
+ __kernel_loff_t l_len;
+ long l_sysid; /* XXXXXXXXXXXXXXXXXXXXXXXXX */
+ __kernel_pid_t l_pid;
+ long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
+};
+
+#ifdef __KERNEL__
+typedef struct flock_lfs lflock_t;
+#endif /* __KERNEL__ */
 
 #endif /* __ASM_MIPS_FCNTL_H */
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-mips64/fcntl.h linux-2.3.99-pre4-locks/include/asm-mips64/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-mips64/fcntl.h Fri Feb 25 07:53:35 2000
+++ linux-2.3.99-pre4-locks/include/asm-mips64/fcntl.h Sat Apr 8 21:39:35 2000
@@ -44,6 +44,13 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 14
+#define F_SETLK64 6
+#define F_SETLKW64 7
+#define F_GETLK_EXT 30
+#define F_SETLK_EXT 31
+#define F_SETLKW_EXT 32
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -72,5 +79,29 @@
         __kernel_pid_t l_pid;
         long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
 } flock_t;
+
+typedef struct flock64 {
+ short l_type;
+ short l_whence;
+ __kernel_off_t l_start;
+ __kernel_off_t l_len;
+ long l_sysid; /* XXXXXXXXXXXXXXXXXXXXXXXXX */
+ __kernel_pid_t l_pid;
+ long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
+};
+
+typedef struct flock_lfs {
+ short l_type;
+ short l_whence;
+ __kernel_loff_t l_start;
+ __kernel_loff_t l_len;
+ long l_sysid; /* XXXXXXXXXXXXXXXXXXXXXXXXX */
+ __kernel_pid_t l_pid;
+ long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
+};
+
+#ifdef __KERNEL__
+typedef struct flock_lfs lflock_t;
+#endif /* __KERNEL__ */
 
 #endif /* _ASM_FCNTL_H */
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-ppc/fcntl.h linux-2.3.99-pre4-locks/include/asm-ppc/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-ppc/fcntl.h Tue Dec 14 09:53:27 1999
+++ linux-2.3.99-pre4-locks/include/asm-ppc/fcntl.h Sat Apr 8 21:47:33 2000
@@ -35,6 +35,13 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 12
+#define F_SETLK64 13
+#define F_SETLKW64 14
+#define F_GETLK_EXT 12
+#define F_SETLK_EXT 13
+#define F_SETLKW_EXT 14
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -67,5 +74,26 @@
         off_t l_len;
         pid_t l_pid;
 };
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+struct flock_lfs {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#ifdef __KERNEL__
+typedef struct flock flock_t;
+typedef struct flock_lfs lflock_t;
+#endif /* __KERNEL__ */
 
 #endif
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-sh/fcntl.h linux-2.3.99-pre4-locks/include/asm-sh/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-sh/fcntl.h Tue Dec 14 09:53:27 1999
+++ linux-2.3.99-pre4-locks/include/asm-sh/fcntl.h Sat Apr 8 21:47:50 2000
@@ -35,6 +35,13 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 12
+#define F_SETLK64 13
+#define F_SETLKW64 14
+#define F_GETLK_EXT 12
+#define F_SETLK_EXT 13
+#define F_SETLKW_EXT 14
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -61,6 +68,27 @@
         off_t l_len;
         pid_t l_pid;
 };
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+struct flock_lfs {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#ifdef __KERNEL__
+typedef struct flock flock_t;
+typedef struct flock_lfs lflock_t;
+#endif /* __KERNEL__ */
 
 #endif /* __ASM_SH_FCNTL_H */
 
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-sparc/fcntl.h linux-2.3.99-pre4-locks/include/asm-sparc/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-sparc/fcntl.h Mon Jan 3 21:01:31 2000
+++ linux-2.3.99-pre4-locks/include/asm-sparc/fcntl.h Sat Apr 8 21:48:01 2000
@@ -34,6 +34,13 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 12
+#define F_SETLK64 13
+#define F_SETLKW64 14
+#define F_GETLK_EXT 12
+#define F_SETLK_EXT 13
+#define F_SETLKW_EXT 14
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -61,5 +68,28 @@
         pid_t l_pid;
         short __unused;
 };
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+ short __unused;
+};
+
+struct flock_lfs {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+ short __unused;
+};
+
+#ifdef __KERNEL__
+typedef struct flock flock_t;
+typedef struct flock_lfs lflock_t;
+#endif /* __KERNEL__ */
 
 #endif
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/asm-sparc64/fcntl.h linux-2.3.99-pre4-locks/include/asm-sparc64/fcntl.h
--- linux-2.3.99-pre4-4/include/asm-sparc64/fcntl.h Fri Jan 7 01:17:19 2000
+++ linux-2.3.99-pre4-locks/include/asm-sparc64/fcntl.h Sat Apr 8 21:48:31 2000
@@ -34,6 +34,13 @@
 #define F_SETSIG 10 /* for sockets. */
 #define F_GETSIG 11 /* for sockets. */
 
+#define F_GETLK64 7
+#define F_SETLK64 8
+#define F_SETLKW64 9
+#define F_GETLK_EXT 12
+#define F_SETLK_EXT 13
+#define F_SETLKW_EXT 14
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
 
@@ -62,6 +69,24 @@
         short __unused;
 };
 
+struct flock64 {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+ short __unused;
+};
+
+struct flock_lfs {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+ short __unused;
+};
+
 #ifdef __KERNEL__
 struct flock32 {
         short l_type;
@@ -71,6 +96,9 @@
         __kernel_pid_t32 l_pid;
         short __unused;
 };
+
+typedef struct flock flock_t;
+typedef struct flock_lfs lflock_t;
 #endif
 
 #endif /* !(_SPARC64_FCNTL_H) */
diff -u --recursive --new-file linux-2.3.99-pre4-4/include/linux/fs.h linux-2.3.99-pre4-locks/include/linux/fs.h
--- linux-2.3.99-pre4-4/include/linux/fs.h Thu Apr 6 23:55:13 2000
+++ linux-2.3.99-pre4-locks/include/linux/fs.h Sun Apr 9 23:27:48 2000
@@ -531,6 +531,10 @@
 
 extern int fcntl_getlk(unsigned int, struct flock *);
 extern int fcntl_setlk(unsigned int, unsigned int, struct flock *);
+#ifndef __alpha__
+extern int extended_getlk(unsigned int, lflock_t *);
+extern int extended_setlk(unsigned int, unsigned int, lflock_t *);
+#endif
 
 /* fs/locks.c */
 extern void locks_remove_posix(struct file *, fl_owner_t);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:12 EST