Annotation of 43BSDReno/usr.sbin/amd/config/mtab_ultrix.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * $Id: mtab_ultrix.c,v 5.2 90/06/23 22:20:57 jsp Rel $
        !             3:  *
        !             4:  * Copyright (c) 1990 Jan-Simon Pendry
        !             5:  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
        !             6:  * Copyright (c) 1990 The Regents of the University of California.
        !             7:  * All rights reserved.
        !             8:  *
        !             9:  * This code is derived from software contributed to Berkeley by
        !            10:  * Jan-Simon Pendry at Imperial College, London.
        !            11:  *
        !            12:  * Redistribution and use in source and binary forms are permitted provided
        !            13:  * that: (1) source distributions retain this entire copyright notice and
        !            14:  * comment, and (2) distributions including binaries display the following
        !            15:  * acknowledgement:  ``This product includes software developed by the
        !            16:  * University of California, Berkeley and its contributors'' in the
        !            17:  * documentation or other materials provided with the distribution and in
        !            18:  * all advertising materials mentioning features or use of this software.
        !            19:  * Neither the name of the University nor the names of its contributors may
        !            20:  * be used to endorse or promote products derived from this software without
        !            21:  * specific prior written permission.
        !            22:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            23:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            24:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            25:  *
        !            26:  *     @(#)mtab_ultrix.c       5.1 (Berkeley) 6/29/90
        !            27:  */
        !            28: 
        !            29: #include "am.h"
        !            30: 
        !            31: #ifdef READ_MTAB_ULTRIX_STYLE
        !            32: 
        !            33: #include <sys/mount.h>
        !            34: #include <sys/fs_types.h>
        !            35: 
        !            36: static struct mntent *mnt_dup(mp)
        !            37: struct fs_data *mp;
        !            38: {
        !            39:        struct mntent *new_mp = ALLOC(mntent);
        !            40: 
        !            41:        new_mp->mnt_fsname = strdup(mp->fd_devname);
        !            42:        new_mp->mnt_dir = strdup(mp->fd_path);
        !            43:         if (mp->fd_fstype >= GT_NUMTYPES)
        !            44:                 mp->fd_fstype = GT_UNKWN;
        !            45:         else if (gt_names[mp->fd_fstype] == 0)
        !            46:                 mp->fd_fstype = GT_UNKWN;
        !            47:         new_mp->mnt_type = strdup(gt_names[mp->fd_fstype]);
        !            48:        new_mp->mnt_opts = strdup("unset");
        !            49: 
        !            50:        new_mp->mnt_freq = 0;
        !            51:        new_mp->mnt_passno = mp->fd_dev;
        !            52: 
        !            53:        return new_mp;
        !            54: }
        !            55: 
        !            56: /*
        !            57:  * Read a mount table into memory
        !            58:  */
        !            59: mntlist *read_mtab(fs)
        !            60: char *fs;
        !            61: {
        !            62:        mntlist **mpp, *mhp;
        !            63: 
        !            64: /* From: Piete Brooks <[email protected]> */
        !            65: 
        !            66:        int loc=0;
        !            67: #undef NMOUNT
        !            68: #define        NMOUNT  20
        !            69:        struct fs_data mountbuffer[NMOUNT], *fs_data;
        !            70:        int ret;
        !            71: 
        !            72:        mpp = &mhp;
        !            73:        while ((ret = getmountent(&loc, mountbuffer, NMOUNT)) > 0) {
        !            74:                for (fs_data = mountbuffer; fs_data < &mountbuffer[ret]; fs_data++) {
        !            75:                        /*
        !            76:                         * Allocate a new slot
        !            77:                         */
        !            78:                        *mpp = ALLOC(mntlist);
        !            79: 
        !            80:                        /*
        !            81:                         * Copy the data returned by getmntent
        !            82:                         */
        !            83:                        (*mpp)->mnt = mnt_dup(fs_data);
        !            84: 
        !            85:                        /*
        !            86:                         * Move to next pointer
        !            87:                         */
        !            88:                        mpp = &(*mpp)->mnext;
        !            89:                }
        !            90:        }
        !            91:        if (ret < 0) {
        !            92:                plog(XLOG_ERROR, "getmountent: %m");
        !            93:                return 0;
        !            94:        }
        !            95:        *mpp = 0;
        !            96: 
        !            97:        return mhp;
        !            98: }
        !            99: 
        !           100: #endif /* READ_MTAB_ULTRIX_STYLE */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.