<commit_before>/*-
 * Copyright (c) 1997, 1998, 1999
 *	Nan Yang Computer Services Limited.  All rights reserved.
 *
 *  Parts copyright (c) 1997, 1998 Cybernet Corporation, NetMAX project.
 *
 *  Written by <NAME>
 *
 *  This software is distributed under the so-called ``Berkeley
 *  License'':
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by Nan Yang Computer
 *	Services Limited.
 * 4. Neither the name of the Company nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * This software is provided ``as is'', and any express or implied
 * warranties, including, but not limited to, the implied warranties of
 * merchantability and fitness for a particular purpose are disclaimed.
 * In no event shall the company or contributors be liable for any
 * direct, indirect, incidental, special, exemplary, or consequential
 * damages (including, but not limited to, procurement of substitute
 * goods or services; loss of use, data, or profits; or business
 * interruption) however caused and on any theory of liability, whether
 * in contract, strict liability, or tort (including negligence or
 * otherwise) arising in any way out of the use of this software, even if
 * advised of the possibility of such damage.
 *
 * $Id: vinumvar.h,v 1.33 2003/05/23 01:09:23 grog Exp grog $
 * $FreeBSD$
 */

#include <sys/time.h>
#include <dev/vinum/vinumstate.h>
#include <sys/mutex.h>

/* Directory for device nodes. */
#define VINUM_DIR   "/dev/vinum"

/*
 * Some configuration maxima.  They're an enum because
 * we can't define global constants.  Sorry about that.
 *
 * These aren't as bad as they look: most of them are soft limits.
 */

#define VINUMROOT
enum constants {
    /*
     * Current version of the data structures.  This
     * is used to ensure synchronization between
     * kernel module and userland vinum(8).
     */
    VINUMVERSION = 1,
    VINUM_HEADER = 512,					    /* size of header on disk */
    MAXCONFIGLINE = 1024,				    /* maximum size of a single config line */
    MINVINUMSLICE = 1048576,				    /* minimum size of a slice */

    VINUM_CDEV_MAJOR = 91,				    /* major number for character device */

    ROUND_ROBIN_READPOL = -1,				    /* round robin read policy */

    /*
     * Type field in high-order two bits of minor
     * number.  Subdisks are in fact both type 2 and
     * type 3, giving twice the number of subdisks.
     * This causes some ugliness in the code.
     */
    VINUM_VOLUME_TYPE = 0,
    VINUM_PLEX_TYPE = 1,
    VINUM_SD_TYPE = 2,
    VINUM_SD2_TYPE = 3,


    /*
     * Define a minor device number.
     * This is not used directly; instead, it's
     * called by the other macros.
     */
#define VINUMMINOR(o,t)  ((o & 0xff) | ((o & 0x3fff00) << 8) | (t << VINUM_TYPE_SHIFT))

    VINUM_TYPE_SHIFT = 30,
    VINUM_MAXVOL = 0x3ffffd,				    /* highest numbered volume */

    /*
     * The super device and the daemon device are
     * magic: they're the two highest-numbered
     * volumes.
     */
    VINUM_SUPERDEV_VOL = 0x3ffffe,
    VINUM_DAEMON_VOL = 0x3fffff,
    VINUM_MAXPLEX = 0x3fffff,
    VINUM_MAXSD = 0x7fffff,

#define VINUM_SUPERDEV_MINOR VINUMMINOR (VINUM_SUPERDEV_VOL, VINUM_VOLUME_TYPE)
#define VINUM_DAEMON_MINOR   VINUMMINOR (VINUM_DAEMON_VOL, VINUM_VOLUME_TYPE)

    /*
     * Mask for the number part of each object.
     * Plexes and volumes are the same, subdisks use
     * the low-order bit of the type field and thus
     * have twice the number.
     */

    MAJORDEV_SHIFT = 8,

    MAXPLEX = 8,					    /* maximum number of plexes in a volume */
    MAXSD = 256,					    /* maximum number of subdisks in a plex */
    MAXDRIVENAME = 32,					    /* maximum length of a device name */
    MAXSDNAME = 64,					    /* maximum length of a subdisk name */
    MAXPLEXNAME = 64,					    /* maximum length of a plex name */
    MAXVOLNAME = 64,					    /* maximum length of a volume name */
    MAXNAME = 64,					    /* maximum length of any name */


#define OBJTYPE(x)	((minor(x) >> VINUM_TYPE_SHIFT) & 3)

    /* Create device minor numbers */
#define VINUMDEV(o, t)		makedev (VINUM_CDEV_MAJOR, VINUMMINOR (o, t))

#define VINUM_VOL(v)		makedev (VINUM_CDEV_MAJOR, \
					 VINUMMINOR (v, VINUM_VOLUME_TYPE))
#define VINUM_PLEX(p)		makedev (VINUM_CDEV_MAJOR, \
					 VINUMMINOR (p, VINUM_PLEX_TYPE))
#define VINUM_SD(s)		makedev (VINUM_CDEV_MAJOR, \
					 VINUMMINOR (s, VINUM_SD_TYPE))

    /* extract device type */
#define DEVTYPE(x) ((minor (x) >> VINUM_TYPE_SHIFT) & 3)

#define VINUM_SUPERDEV_NAME VINUM_DIR"/control"		    /* normal super device */
#define VINUM_DAEMON_DEV_NAME VINUM_DIR"/controld"	    /* super device for daemon only */

    /*
     * the number of object entries to cater for initially, and also the
     * value by which they are incremented.  It doesn't take long
     * to extend them, so theoretically we could start with 1 of each, but
     * it's untidy to allocate such small areas.  These values are
     * probably too small.
     */

    INITIAL_DRIVES = 4,
    INITIAL_VOLUMES = 4,
    INITIAL_PLEXES = 8,
    INITIAL_SUBDISKS = 16,
    INITIAL_SUBDISKS_IN_PLEX = 4,			    /* number of subdisks to allocate to a plex */
    INITIAL_SUBDISKS_IN_DRIVE = 4,			    /* number of subdisks to allocate to a drive */
    INITIAL_DRIVE_FREELIST = 16,			    /* number of entries in drive freelist */
    PLEX_REGION_TABLE_SIZE = 8,				    /* number of entries in plex region tables */
    PLEX_LOCKS = 256,					    /* number of locks to allocate to a plex */
    PLEXMUTEXES = 32,
    MAX_REVIVE_BLOCKSIZE = MAXPHYS,			    /* maximum revive block size */
    DEFAULT_REVIVE_BLOCKSIZE = 65536,			    /* default revive block size */
    VINUMHOSTNAMELEN = 32,				    /* host name field in label */
};
<commit_msg>Remove some more 'makedev' related macros.<commit_after>/*-
 * Copyright (c) 1997, 1998, 1999
 *	Nan Yang Computer Services Limited.  All rights reserved.
 *
 *  Parts copyright (c) 1997, 1998 Cybernet Corporation, NetMAX project.
 *
 *  Written by <NAME>
 *
 *  This software is distributed under the so-called ``Berkeley
 *  License'':
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by Nan Yang Computer
 *	Services Limited.
 * 4. Neither the name of the Company nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * This software is provided ``as is'', and any express or implied
 * warranties, including, but not limited to, the implied warranties of
 * merchantability and fitness for a particular purpose are disclaimed.
 * In no event shall the company or contributors be liable for any
 * direct, indirect, incidental, special, exemplary, or consequential
 * damages (including, but not limited to, procurement of substitute
 * goods or services; loss of use, data, or profits; or business
 * interruption) however caused and on any theory of liability, whether
 * in contract, strict liability, or tort (including negligence or
 * otherwise) arising in any way out of the use of this software, even if
 * advised of the possibility of such damage.
 *
 * $Id: vinumvar.h,v 1.33 2003/05/23 01:09:23 grog Exp grog $
 * $FreeBSD$
 */

#include <sys/time.h>
#include <dev/vinum/vinumstate.h>
#include <sys/mutex.h>

/* Directory for device nodes. */
#define VINUM_DIR   "/dev/vinum"

/*
 * Some configuration maxima.  They're an enum because
 * we can't define global constants.  Sorry about that.
 *
 * These aren't as bad as they look: most of them are soft limits.
 */

#define VINUMROOT
enum constants {
    /*
     * Current version of the data structures.  This
     * is used to ensure synchronization between
     * kernel module and userland vinum(8).
     */
    VINUMVERSION = 1,
    VINUM_HEADER = 512,					    /* size of header on disk */
    MAXCONFIGLINE = 1024,				    /* maximum size of a single config line */
    MINVINUMSLICE = 1048576,				    /* minimum size of a slice */

    VINUM_CDEV_MAJOR = 91,				    /* major number for character device */

    ROUND_ROBIN_READPOL = -1,				    /* round robin read policy */

    /*
     * Type field in high-order two bits of minor
     * number.  Subdisks are in fact both type 2 and
     * type 3, giving twice the number of subdisks.
     * This causes some ugliness in the code.
     */
    VINUM_VOLUME_TYPE = 0,
    VINUM_PLEX_TYPE = 1,
    VINUM_SD_TYPE = 2,
    VINUM_SD2_TYPE = 3,


    /*
     * Define a minor device number.
     * This is not used directly; instead, it's
     * called by the other macros.
     */
#define VINUMMINOR(o,t)  ((o & 0xff) | ((o & 0x3fff00) << 8) | (t << VINUM_TYPE_SHIFT))

    VINUM_TYPE_SHIFT = 30,
    VINUM_MAXVOL = 0x3ffffd,				    /* highest numbered volume */

    /*
     * The super device and the daemon device are
     * magic: they're the two highest-numbered
     * volumes.
     */
    VINUM_SUPERDEV_VOL = 0x3ffffe,
    VINUM_DAEMON_VOL = 0x3fffff,
    VINUM_MAXPLEX = 0x3fffff,
    VINUM_MAXSD = 0x7fffff,

#define VINUM_SUPERDEV_MINOR VINUMMINOR (VINUM_SUPERDEV_VOL, VINUM_VOLUME_TYPE)
#define VINUM_DAEMON_MINOR   VINUMMINOR (VINUM_DAEMON_VOL, VINUM_VOLUME_TYPE)

    /*
     * Mask for the number part of each object.
     * Plexes and volumes are the same, subdisks use
     * the low-order bit of the type field and thus
     * have twice the number.
     */

    MAJORDEV_SHIFT = 8,

    MAXPLEX = 8,					    /* maximum number of plexes in a volume */
    MAXSD = 256,					    /* maximum number of subdisks in a plex */
    MAXDRIVENAME = 32,					    /* maximum length of a device name */
    MAXSDNAME = 64,					    /* maximum length of a subdisk name */
    MAXPLEXNAME = 64,					    /* maximum length of a plex name */
    MAXVOLNAME = 64,					    /* maximum length of a volume name */
    MAXNAME = 64,					    /* maximum length of any name */


#define OBJTYPE(x)	((minor(x) >> VINUM_TYPE_SHIFT) & 3)

    /* extract device type */
#define DEVTYPE(x) ((minor (x) >> VINUM_TYPE_SHIFT) & 3)

#define VINUM_SUPERDEV_NAME VINUM_DIR"/control"		    /* normal super device */
#define VINUM_DAEMON_DEV_NAME VINUM_DIR"/controld"	    /* super device for daemon only */

    /*
     * the number of object entries to cater for initially, and also the
     * value by which they are incremented.  It doesn't take long
     * to extend them, so theoretically we could start with 1 of each, but
     * it's untidy to allocate such small areas.  These values are
     * probably too small.
     */

    INITIAL_DRIVES = 4,
    INITIAL_VOLUMES = 4,
    INITIAL_PLEXES = 8,
    INITIAL_SUBDISKS = 16,
    INITIAL_SUBDISKS_IN_PLEX = 4,			    /* number of subdisks to allocate to a plex */
    INITIAL_SUBDISKS_IN_DRIVE = 4,			    /* number of subdisks to allocate to a drive */
    INITIAL_DRIVE_FREELIST = 16,			    /* number of entries in drive freelist */
    PLEX_REGION_TABLE_SIZE = 8,				    /* number of entries in plex region tables */
    PLEX_LOCKS = 256,					    /* number of locks to allocate to a plex */
    PLEXMUTEXES = 32,
    MAX_REVIVE_BLOCKSIZE = MAXPHYS,			    /* maximum revive block size */
    DEFAULT_REVIVE_BLOCKSIZE = 65536,			    /* default revive block size */
    VINUMHOSTNAMELEN = 32,				    /* host name field in label */
};

{'fraction_non_alphanumeric': 0.0796221322537112, 'fraction_numerical': 0.01984599507819322, 'mean_word_length': 2.838513101767215, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3916673', 'n_tokens_mistral': 4383, 'n_tokens_neox': 3861, 'n_words': 1488}