From: David van Moolenbroek Date: Sat, 31 Aug 2013 21:11:34 +0000 (+0200) Subject: Remove support for obsolete 3.2.1 ABI X-Git-Tag: v3.3.0~619 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F939%2F2;p=minix.git Remove support for obsolete 3.2.1 ABI Change-Id: I76b4960bda41f55d9c42f8c99c5beae3424ca851 --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 3fc3973ff..31f3b9522 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -17,7 +17,6 @@ #define CHMOD 15 #define CHOWN 16 #define BRK 17 -#define LSEEK_321 19 #define MINIX_GETPID 20 #define MOUNT 21 #define UMOUNT 22 @@ -48,7 +47,6 @@ #define FSTAT 52 #define LSTAT 53 #define IOCTL 54 -#define FCNTL_321 55 #define FS_READY 57 #define PIPE2 58 #define EXEC 59 @@ -72,7 +70,6 @@ #define REBOOT 76 #define SVRCTL 77 #define SYSUNAME 78 -#define GETDENTS_321 80 /* to VFS */ #define LLSEEK 81 /* to VFS */ #define GETVFSSTAT 82 /* to VFS */ #define STATVFS1 83 /* to VFS */ @@ -85,8 +82,6 @@ #define GETTIMEOFDAY 90 /* to PM */ #define SETEUID 91 /* to PM */ #define SETEGID 92 /* to PM */ -#define TRUNCATE_321 93 /* to VFS */ -#define FTRUNCATE_321 94 /* to VFS */ #define FCHMOD 95 /* to VFS */ #define FCHOWN 96 /* to VFS */ #define LSEEK 97 diff --git a/lib/libc/sys-minix/fcntl.c b/lib/libc/sys-minix/fcntl.c index 1c6a29f45..59c37a652 100644 --- a/lib/libc/sys-minix/fcntl.c +++ b/lib/libc/sys-minix/fcntl.c @@ -2,7 +2,6 @@ #include "namespace.h" #include -#include #include #include @@ -10,78 +9,12 @@ __weak_alias(fcntl, _fcntl) #endif -static int __fcntl_321(int fd, int cmd, va_list argp); - -int __fcntl_321(int fd, int cmd, va_list argp) -{ - message m; - struct flock_321 f_321; - struct flock *flock; - int r; - - /* Set up for the sensible case where there is no variable parameter. This - * covers F_GETFD, F_GETFL and invalid commands. - */ - m.m1_i3 = 0; - m.m1_p1 = NULL; - - /* Adjust for the stupid cases. */ - switch(cmd) { - case F_DUPFD: - case F_SETFD: - case F_SETFL: - m.m1_i3 = va_arg(argp, int); - break; - case F_GETLK: - case F_SETLK: - case F_SETLKW: - case F_FREESP: - /* VFS expects old format, so translate */ - flock = (struct flock *) va_arg(argp, struct flock *); - f_321.l_type = flock->l_type; - f_321.l_whence = flock->l_whence; - f_321.l_start = flock->l_start; - f_321.l_len = flock->l_len; - f_321.l_pid = flock->l_pid; - m.m1_p1 = (char *) &f_321; - break; - } - - /* Clean up and make the system call. */ - m.m1_i1 = fd; - m.m1_i2 = cmd; - - r = _syscall(VFS_PROC_NR, FCNTL_321, &m); - - if (r == 0) { - /* Maybe we need to convert back */ - - switch(cmd) { - case F_GETLK: - case F_SETLK: - case F_SETLKW: - case F_FREESP: - /* VFS expected old format but libc new format, so translate */ - flock->l_type = f_321.l_type; - flock->l_whence = f_321.l_whence; - flock->l_start = f_321.l_start; - flock->l_len = f_321.l_len; - flock->l_pid = f_321.l_pid; - break; - } - } - - return r; -} - int fcntl(int fd, int cmd, ...) { - va_list argp, argp_321; + va_list argp; message m; - int r, org_errno; va_start(argp, cmd); - va_start(argp_321, cmd); /* Set up for the sensible case where there is no variable parameter. This * covers F_GETFD, F_GETFL and invalid commands. @@ -108,15 +41,5 @@ int fcntl(int fd, int cmd, ...) va_end(argp); m.m1_i1 = fd; m.m1_i2 = cmd; - org_errno = errno; - r = _syscall(VFS_PROC_NR, FCNTL, &m); - - if (r == -1 && errno == ENOSYS) { - errno = org_errno; - r = __fcntl_321(fd, cmd, argp_321); - } - - va_end(argp_321); - - return r; + return(_syscall(VFS_PROC_NR, FCNTL, &m)); } diff --git a/lib/libc/sys-minix/ftruncate.c b/lib/libc/sys-minix/ftruncate.c index 4437dfea8..937a3dcdb 100644 --- a/lib/libc/sys-minix/ftruncate.c +++ b/lib/libc/sys-minix/ftruncate.c @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -11,38 +10,13 @@ __weak_alias(ftruncate, _ftruncate) #endif -static int __ftruncate_321(int _fd, int _length); - -static int __ftruncate_321(int _fd, int _length) -{ - message m; - m.m2_l1 = _length; - m.m2_i1 = _fd; - - return(_syscall(VFS_PROC_NR, FTRUNCATE_321, &m)); -} - int ftruncate(int _fd, off_t _length) { message m; - int orig_errno, r; m.m2_l1 = ex64lo(_length); m.m2_l2 = ex64hi(_length); m.m2_i1 = _fd; - orig_errno = errno; - r = _syscall(VFS_PROC_NR, FTRUNCATE, &m); - if (r == -1 && errno == ENOSYS) { - /* Old VFS, no support for new ftruncate */ - if (_length >= INT_MIN && _length <= INT_MAX) { - errno = orig_errno; - return __ftruncate_321(_fd, (int) _length); - } - - /* Not going to fit */ - errno = EOVERFLOW; - } - - return r; + return(_syscall(VFS_PROC_NR, FTRUNCATE, &m)); } diff --git a/lib/libc/sys-minix/getdents.c b/lib/libc/sys-minix/getdents.c index 1cb2d715f..ef17e5440 100644 --- a/lib/libc/sys-minix/getdents.c +++ b/lib/libc/sys-minix/getdents.c @@ -3,83 +3,15 @@ #include #include -#include -#include -#include -#include - -static ssize_t __getdents321(int fd, char *buffer, size_t nbytes); ssize_t getdents(int fd, char *buffer, size_t nbytes) { message m; - int r, orig_errno; - orig_errno = errno; m.m1_i1 = fd; m.m1_i2 = nbytes; m.m1_p1 = (char *) buffer; - r = _syscall(VFS_PROC_NR, GETDENTS, &m); - if (r == -1 && errno == ENOSYS) { - errno = orig_errno;/* Restore old value so world is still as expected*/ - r = __getdents321(fd, buffer, nbytes); - } - - return r; -} - -ssize_t __getdents321(int fd, char *buffer, size_t nbytes) -{ - message m; - int r, consumed = 0, newconsumed = 0; - char *intermediate = NULL; - struct dirent *dent; - struct dirent_321 *dent_321; -#define DWORD_ALIGN(d) if((d) % sizeof(long)) (d)+=sizeof(long)-(d)%sizeof(long) - - intermediate = malloc(nbytes); - if (intermediate == NULL) return EINVAL; - - m.m1_i1 = fd; - /* Pretend the buffer is smaller so we know the converted/expanded version - * will fit. - */ - nbytes = nbytes / 2; - if (nbytes < (sizeof(struct dirent) + NAME_MAX + 1)) { - free(intermediate); - return EINVAL; /* This might not fit. Sorry */ - } - - m.m1_i2 = nbytes; - m.m1_p1 = (char *) intermediate; - r = _syscall(VFS_PROC_NR, GETDENTS_321, &m); - - if (r <= 0) { - free(intermediate); - return r; - } - - /* Provided format is struct dirent_321 and has to be translated to - * struct dirent */ - dent_321 = (struct dirent_321 *) intermediate; - dent = (struct dirent *) buffer; - - while (consumed < r && dent_321->d_reclen > 0) { - dent->d_ino = (ino_t) dent_321->d_ino; - dent->d_off = (off_t) dent_321->d_off; - dent->d_reclen = offsetof(struct dirent, d_name) + - strlen(dent_321->d_name) + 1; - DWORD_ALIGN(dent->d_reclen); - strcpy(dent->d_name, dent_321->d_name); - consumed += dent_321->d_reclen; - newconsumed += dent->d_reclen; - dent_321 = (struct dirent_321 *) &intermediate[consumed]; - dent = (struct dirent *) &buffer[newconsumed]; - } - - free(intermediate); - - return newconsumed; + return _syscall(VFS_PROC_NR, GETDENTS, &m); } #if defined(__minix) && defined(__weak_alias) diff --git a/lib/libc/sys-minix/lseek.c b/lib/libc/sys-minix/lseek.c index 73d8414f0..570f7b8a4 100644 --- a/lib/libc/sys-minix/lseek.c +++ b/lib/libc/sys-minix/lseek.c @@ -3,52 +3,24 @@ #include #include -#include #include #ifdef __weak_alias __weak_alias(lseek, _lseek) #endif -i32_t __lseek_321(int fd, i32_t offset, int whence); - -i32_t __lseek_321(int fd, i32_t offset, int whence) -{ - message m; - - m.m2_i1 = fd; - m.m2_l1 = offset; - m.m2_i2 = whence; - if (_syscall(VFS_PROC_NR, LSEEK_321, &m) < 0) return(-1); - return( (i32_t) m.m2_l1); -} - off_t lseek(int fd, off_t offset, int whence) { message m; - int orig_errno; m.m2_i1 = fd; m.m2_l1 = ex64lo(offset); m.m2_l2 = ex64hi(offset); m.m2_i2 = whence; - orig_errno = errno; - if (_syscall(VFS_PROC_NR, LSEEK, &m) < 0) { - if (errno == ENOSYS) { - /* Old VFS, no support for new lseek */ - if (offset >= INT_MIN && offset <= INT_MAX) { - /* offset fits in old range, retry */ - errno = orig_errno; - return (off_t) __lseek_321(fd, (i32_t) offset, whence); - } - - /* Not going to fit */ - errno = EOVERFLOW; - } - + if (_syscall(VFS_PROC_NR, LSEEK, &m) < 0) return( (off_t) -1); - } + return( (off_t) make64(m.m2_l1, m.m2_l2)); } diff --git a/lib/libc/sys-minix/truncate.c b/lib/libc/sys-minix/truncate.c index 1d20db861..5072a982e 100644 --- a/lib/libc/sys-minix/truncate.c +++ b/lib/libc/sys-minix/truncate.c @@ -7,45 +7,17 @@ __weak_alias(truncate, _truncate) #endif #include -#include #include #include -static int __truncate_321(const char *_path, int _length); - -static int __truncate_321(const char *_path, int _length) -{ - message m; - m.m2_p1 = (char *) __UNCONST(_path); - m.m2_i1 = strlen(_path)+1; - m.m2_l1 = _length; - - return(_syscall(VFS_PROC_NR, TRUNCATE_321, &m)); -} - int truncate(const char *_path, off_t _length) { message m; - int orig_errno, r; m.m2_p1 = (char *) __UNCONST(_path); m.m2_i1 = strlen(_path)+1; m.m2_l1 = ex64lo(_length); m.m2_l2 = ex64hi(_length); - orig_errno = errno; - r = _syscall(VFS_PROC_NR, TRUNCATE, &m); - - if (r == -1 && errno == ENOSYS) { - /* Old VFS, no support for new truncate */ - if (_length >= INT_MIN && _length <= INT_MAX) { - errno = orig_errno; - return __truncate_321(_path, (int) _length); - } - - /* Not going to fit */ - errno = EOVERFLOW; - } - - return r; + return(_syscall(VFS_PROC_NR, TRUNCATE, &m)); } diff --git a/servers/vfs/link.c b/servers/vfs/link.c index c29c2119f..9ad1c223a 100644 --- a/servers/vfs/link.c +++ b/servers/vfs/link.c @@ -16,7 +16,6 @@ #include #include #include -#include /* Remove with version check in do_truncate */ #include #include #include @@ -307,13 +306,8 @@ int do_truncate(message *UNUSED(m_out)) resolve.l_vmnt_lock = VMNT_READ; resolve.l_vnode_lock = VNODE_WRITE; - if (job_call_nr == TRUNCATE_321) { - length = (off_t) job_m_in.m2_l1; - if ((int) job_m_in.flength < 0) return(EINVAL); - } else { - length = (off_t) make64(job_m_in.m2_l1, job_m_in.m2_l2); - if (length < 0) return(EINVAL); - } + length = (off_t) make64(job_m_in.m2_l1, job_m_in.m2_l2); + if (length < 0) return(EINVAL); /* Temporarily open file */ if (fetch_name(vname, vname_length, fullpath) != OK) return(err_code); @@ -350,14 +344,8 @@ int do_ftruncate(message *UNUSED(m_out)) scratch(fp).file.fd_nr = job_m_in.fd; - if (job_call_nr == FTRUNCATE_321) { - length = (off_t) job_m_in.m2_l1; - if ((int) job_m_in.flength < 0) return(EINVAL); - } else { - length = (off_t) make64(job_m_in.m2_l1, job_m_in.m2_l2); - if (length < 0) return(EINVAL); - } - + length = (off_t) make64(job_m_in.m2_l1, job_m_in.m2_l2); + if (length < 0) return(EINVAL); /* File is already opened; get a vnode pointer from filp */ if ((rfilp = get_filp(scratch(fp).file.fd_nr, VNODE_WRITE)) == NULL) diff --git a/servers/vfs/lock.c b/servers/vfs/lock.c index 8d9e9ae6b..e762d88e8 100644 --- a/servers/vfs/lock.c +++ b/servers/vfs/lock.c @@ -6,7 +6,6 @@ */ #include "fs.h" -#include #include #include #include @@ -31,26 +30,11 @@ int req; /* either F_SETLK or F_SETLKW */ mode_t mo; off_t first, last; struct flock flock; - struct flock_321 fa_321; struct file_lock *flp, *flp2, *empty; /* Fetch the flock structure from user space. */ - if (job_call_nr == FCNTL_321) { - r = sys_datacopy(who_e, (vir_bytes) scratch(fp).io.io_buffer, - VFS_PROC_NR, (vir_bytes) &fa_321, sizeof(fa_321)); - - /* Convert old values to new structure */ - if (r == OK) { - flock.l_type = fa_321.l_type; - flock.l_whence = fa_321.l_whence; - flock.l_start = (off_t) fa_321.l_start; - flock.l_len = (off_t) fa_321.l_len; - flock.l_pid = fa_321.l_pid; - } - } else { - r = sys_datacopy(who_e, (vir_bytes) scratch(fp).io.io_buffer, - VFS_PROC_NR, (vir_bytes) &flock, sizeof(flock)); - } + r = sys_datacopy(who_e, (vir_bytes) scratch(fp).io.io_buffer, VFS_PROC_NR, + (vir_bytes) &flock, sizeof(flock)); if (r != OK) return(EINVAL); /* Make some error checks. */ @@ -159,23 +143,8 @@ int req; /* either F_SETLK or F_SETLKW */ } /* Copy the flock structure back to the caller. */ - if (job_call_nr == FCNTL_321) { - /* Convert new values to old structure */ - if (r == OK) { - fa_321.l_type = flock.l_type; - fa_321.l_whence = flock.l_whence; - fa_321.l_start = (i32_t) flock.l_start; - fa_321.l_len = (i32_t) flock.l_len; - fa_321.l_pid = flock.l_pid; - } - r = sys_datacopy(VFS_PROC_NR, (vir_bytes) &fa_321, - who_e, (vir_bytes) scratch(fp).io.io_buffer, - sizeof(fa_321)); - } else { - r = sys_datacopy(VFS_PROC_NR, (vir_bytes) &flock, - who_e, (vir_bytes) scratch(fp).io.io_buffer, - sizeof(flock)); - } + r = sys_datacopy(VFS_PROC_NR, (vir_bytes) &flock, who_e, + (vir_bytes) scratch(fp).io.io_buffer, sizeof(flock)); return(r); } diff --git a/servers/vfs/misc.c b/servers/vfs/misc.c index 453c78946..0ab27abc5 100644 --- a/servers/vfs/misc.c +++ b/servers/vfs/misc.c @@ -180,24 +180,8 @@ int do_fcntl(message *UNUSED(m_out)) else if (!(f->filp_mode & W_BIT)) r = EBADF; else { /* Copy flock data from userspace. */ - if (job_call_nr == FCNTL_321) { - struct flock_321 fa_321; - r = sys_datacopy(who_e, - (vir_bytes) scratch(fp).io.io_buffer, SELF, - (vir_bytes) &fa_321, sizeof(fa_321)); - /* Let's convert the values to the new structure */ - if (r == OK) { - flock_arg.l_type = fa_321.l_type; - flock_arg.l_whence = fa_321.l_whence; - flock_arg.l_start = (off_t) fa_321.l_start; - flock_arg.l_len = (off_t) fa_321.l_len; - flock_arg.l_pid = fa_321.l_pid; - } - } else { - r = sys_datacopy(who_e, - (vir_bytes) scratch(fp).io.io_buffer, SELF, - (vir_bytes) &flock_arg, sizeof(flock_arg)); - } + r = sys_datacopy(who_e, (vir_bytes) scratch(fp).io.io_buffer, + SELF, (vir_bytes) &flock_arg, sizeof(flock_arg)); } if (r != OK) break; diff --git a/servers/vfs/open.c b/servers/vfs/open.c index 769687ed2..1a20796f1 100644 --- a/servers/vfs/open.c +++ b/servers/vfs/open.c @@ -7,7 +7,6 @@ * do_mkdir: perform the MKDIR system call * do_close: perform the CLOSE system call * do_lseek: perform the LSEEK system call - * do_llseek: perform the LLSEEK system call */ #include "fs.h" @@ -645,24 +644,6 @@ int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence, return(r); } -/*===========================================================================* - * do_lseek_321 * - *===========================================================================*/ -int do_lseek_321(message *m_out) -{ - int r; - - r = actual_llseek(fp, m_out, job_m_in.ls_fd, job_m_in.whence, - make64(job_m_in.offset_lo, 0)); - - /* check value is 32bit */ - if (m_out->reply_l2 != 0) { - r = EOVERFLOW; - } - - return r; -} - /*===========================================================================* * do_lseek * *===========================================================================*/ @@ -672,15 +653,6 @@ int do_lseek(message *m_out) make64(job_m_in.offset_lo, job_m_in.offset_high)); } -/*===========================================================================* - * do_llseek * - *===========================================================================*/ -int do_llseek(message *m_out) -{ - return actual_llseek(fp, m_out, job_m_in.ls_fd, job_m_in.whence, - make64(job_m_in.offset_lo, job_m_in.offset_high)); -} - /*===========================================================================* * do_close * *===========================================================================*/ diff --git a/servers/vfs/proto.h b/servers/vfs/proto.h index a44888e71..0dfc90dbd 100644 --- a/servers/vfs/proto.h +++ b/servers/vfs/proto.h @@ -168,13 +168,10 @@ void close_reply(void); int common_open(char path[PATH_MAX], int oflags, mode_t omode); int do_creat(void); int do_lseek(message *m_out); -int do_lseek_321(message *m_out); -int do_llseek(message *m_out); int do_mknod(message *m_out); int do_mkdir(message *m_out); int do_open(message *m_out); int do_slink(message *m_out); -int actual_lseek(message *m_out, int seekfd, int seekwhence, off_t offset); int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence, off_t offset); int do_vm_open(void); diff --git a/servers/vfs/table.c b/servers/vfs/table.c index 5afc110af..285f90100 100644 --- a/servers/vfs/table.c +++ b/servers/vfs/table.c @@ -34,7 +34,7 @@ int (*call_vec[])(message *m_out) = { do_chown, /* 16 = chown */ no_sys, /* 17 = break */ no_sys, /* 18 = unused (was old stat)*/ - no_sys, /* 19 = unused (was lseek_321)*/ + no_sys, /* 19 = unused */ no_sys, /* 20 = getpid */ do_mount, /* 21 = mount */ do_umount, /* 22 = umount */ @@ -95,7 +95,7 @@ int (*call_vec[])(message *m_out) = { do_svrctl, /* 77 = svrctl */ no_sys, /* 78 = (sysuname) */ no_sys, /* 79 = unused */ - do_getdents, /* 80 = getdents_321 (to be phased out) */ + no_sys, /* 80 = unused */ do_lseek, /* 81 = llseek */ do_getvfsstat, /* 82 = getvfsstat */ do_statvfs, /* 83 = fstatvfs */ @@ -108,8 +108,8 @@ int (*call_vec[])(message *m_out) = { no_sys, /* 90 = (gettimeofday) */ no_sys, /* 91 = (seteuid) */ no_sys, /* 92 = (setegid) */ - do_truncate, /* 93 = truncate_321 (to be phased out) */ - do_ftruncate, /* 94 = ftruncate_321 (to be phased out) */ + no_sys, /* 93 = unused */ + no_sys, /* 94 = unused */ do_chmod, /* 95 = fchmod */ do_chown, /* 96 = fchown */ do_lseek, /* 97 = lseek */ diff --git a/sys/sys/dirent.h b/sys/sys/dirent.h index d09ce8b29..3bdc05006 100644 --- a/sys/sys/dirent.h +++ b/sys/sys/dirent.h @@ -17,13 +17,6 @@ struct dirent { /* Largest entry (8 slots) */ char d_name[1]; /* Null terminated name */ }; -struct dirent_321 { /* Largest entry (8 slots) */ - u32_t d_ino; /* I-node number */ - i32_t d_off; /* Offset in directory */ - unsigned short d_reclen; /* Length of this record */ - char d_name[1]; /* Null terminated name */ -}; - #if defined(_NETBSD_SOURCE) #define MAXNAMLEN 511 #define d_fileno d_ino diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index c556b4107..0fab6a5bc 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -153,14 +153,6 @@ struct flock { pid_t l_pid; /* process id of the locks' owner */ }; -struct flock_321 { - short l_type; /* type: F_RDLCK, F_WRLCK, or F_UNLCK */ - short l_whence; /* flag for starting offset */ - i32_t l_start; /* relative offset in bytes */ - i32_t l_len; /* size; if 0, then until EOF */ - pid_t l_pid; /* process id of the locks' owner */ -}; - #if defined(_NETBSD_SOURCE) /* lock operations for flock(2) */ #define LOCK_SH F_RDLCK /* Shared lock */