Merge branch 'linux-2.6'
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
header-y += byteorder/
|
||||
header-y += can/
|
||||
header-y += dvb/
|
||||
header-y += hdlc/
|
||||
header-y += isdn/
|
||||
@@ -34,13 +35,13 @@ header-y += atmsap.h
|
||||
header-y += atmsvc.h
|
||||
header-y += atm_zatm.h
|
||||
header-y += auto_fs4.h
|
||||
header-y += auxvec.h
|
||||
header-y += ax25.h
|
||||
header-y += b1lli.h
|
||||
header-y += baycom.h
|
||||
header-y += bfs_fs.h
|
||||
header-y += blkpg.h
|
||||
header-y += bpqether.h
|
||||
header-y += can.h
|
||||
header-y += cdk.h
|
||||
header-y += chio.h
|
||||
header-y += coda_psdev.h
|
||||
@@ -49,6 +50,7 @@ header-y += comstats.h
|
||||
header-y += const.h
|
||||
header-y += cgroupstats.h
|
||||
header-y += cycx_cfm.h
|
||||
header-y += dlmconstants.h
|
||||
header-y += dlm_device.h
|
||||
header-y += dlm_netlink.h
|
||||
header-y += dm-ioctl.h
|
||||
@@ -72,7 +74,7 @@ header-y += gen_stats.h
|
||||
header-y += gigaset_dev.h
|
||||
header-y += hdsmart.h
|
||||
header-y += hysdn_if.h
|
||||
header-y += i2c-dev.h
|
||||
header-y += i2o-dev.h
|
||||
header-y += i8k.h
|
||||
header-y += if_arcnet.h
|
||||
header-y += if_bonding.h
|
||||
@@ -98,7 +100,6 @@ header-y += iso_fs.h
|
||||
header-y += ixjuser.h
|
||||
header-y += jffs2.h
|
||||
header-y += keyctl.h
|
||||
header-y += kvm.h
|
||||
header-y += limits.h
|
||||
header-y += lock_dlm_plock.h
|
||||
header-y += magic.h
|
||||
@@ -157,7 +158,6 @@ header-y += veth.h
|
||||
header-y += video_decoder.h
|
||||
header-y += video_encoder.h
|
||||
header-y += videotext.h
|
||||
header-y += vt.h
|
||||
header-y += x25.h
|
||||
|
||||
unifdef-y += acct.h
|
||||
@@ -172,6 +172,7 @@ unifdef-y += atm.h
|
||||
unifdef-y += atm_tcp.h
|
||||
unifdef-y += audit.h
|
||||
unifdef-y += auto_fs.h
|
||||
unifdef-y += auxvec.h
|
||||
unifdef-y += binfmts.h
|
||||
unifdef-y += capability.h
|
||||
unifdef-y += capi.h
|
||||
@@ -213,7 +214,7 @@ unifdef-y += hdreg.h
|
||||
unifdef-y += hiddev.h
|
||||
unifdef-y += hpet.h
|
||||
unifdef-y += i2c.h
|
||||
unifdef-y += i2o-dev.h
|
||||
unifdef-y += i2c-dev.h
|
||||
unifdef-y += icmp.h
|
||||
unifdef-y += icmpv6.h
|
||||
unifdef-y += if_addr.h
|
||||
@@ -228,7 +229,6 @@ unifdef-y += if_ltalk.h
|
||||
unifdef-y += if_link.h
|
||||
unifdef-y += if_pppol2tp.h
|
||||
unifdef-y += if_pppox.h
|
||||
unifdef-y += if_shaper.h
|
||||
unifdef-y += if_tr.h
|
||||
unifdef-y += if_tun.h
|
||||
unifdef-y += if_vlan.h
|
||||
@@ -255,6 +255,7 @@ unifdef-y += kd.h
|
||||
unifdef-y += kernelcapi.h
|
||||
unifdef-y += kernel.h
|
||||
unifdef-y += keyboard.h
|
||||
unifdef-$(CONFIG_HAVE_KVM) += kvm.h
|
||||
unifdef-y += llc.h
|
||||
unifdef-y += loop.h
|
||||
unifdef-y += lp.h
|
||||
@@ -348,6 +349,7 @@ unifdef-y += videodev.h
|
||||
unifdef-y += virtio_config.h
|
||||
unifdef-y += virtio_blk.h
|
||||
unifdef-y += virtio_net.h
|
||||
unifdef-y += vt.h
|
||||
unifdef-y += wait.h
|
||||
unifdef-y += wanrouter.h
|
||||
unifdef-y += watchdog.h
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <acpi/acpi_drivers.h>
|
||||
#include <acpi/acpi_numa.h>
|
||||
#include <asm/acpi.h>
|
||||
#include <linux/dmi.h>
|
||||
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
@@ -192,7 +193,9 @@ extern int ec_transaction(u8 command,
|
||||
#endif /*CONFIG_ACPI_EC*/
|
||||
|
||||
extern int acpi_blacklisted(void);
|
||||
extern void acpi_bios_year(char *s);
|
||||
#ifdef CONFIG_DMI
|
||||
extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_NUMA
|
||||
int acpi_get_pxm(acpi_handle handle);
|
||||
@@ -226,5 +229,5 @@ static inline int acpi_boot_table_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ACPI */
|
||||
#endif /* !CONFIG_ACPI */
|
||||
#endif /*_LINUX_ACPI_H*/
|
||||
|
@@ -25,6 +25,8 @@ static inline u32 acpi_pm_read_early(void)
|
||||
return acpi_pm_read_verified() & ACPI_PM_MASK;
|
||||
}
|
||||
|
||||
extern void pmtimer_wait(unsigned);
|
||||
|
||||
#else
|
||||
|
||||
static inline u32 acpi_pm_read_early(void)
|
||||
|
@@ -286,9 +286,10 @@ enum {
|
||||
ATA_CBL_NONE = 0,
|
||||
ATA_CBL_PATA40 = 1,
|
||||
ATA_CBL_PATA80 = 2,
|
||||
ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */
|
||||
ATA_CBL_PATA_UNK = 4,
|
||||
ATA_CBL_SATA = 5,
|
||||
ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */
|
||||
ATA_CBL_PATA_UNK = 4, /* don't know, maybe 80c? */
|
||||
ATA_CBL_PATA_IGN = 5, /* don't know, ignore cable handling */
|
||||
ATA_CBL_SATA = 6,
|
||||
|
||||
/* SATA Status and Control Registers */
|
||||
SCR_STATUS = 0,
|
||||
@@ -324,6 +325,13 @@ enum {
|
||||
ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
|
||||
ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
|
||||
ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
|
||||
|
||||
/* protocol flags */
|
||||
ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
|
||||
ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
|
||||
ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
|
||||
ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
|
||||
ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
|
||||
};
|
||||
|
||||
enum ata_tf_protocols {
|
||||
@@ -333,9 +341,9 @@ enum ata_tf_protocols {
|
||||
ATA_PROT_PIO, /* PIO data xfer */
|
||||
ATA_PROT_DMA, /* DMA */
|
||||
ATA_PROT_NCQ, /* NCQ */
|
||||
ATA_PROT_ATAPI, /* packet command, PIO data xfer*/
|
||||
ATA_PROT_ATAPI_NODATA, /* packet command, no data */
|
||||
ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */
|
||||
ATAPI_PROT_NODATA, /* packet command, no data */
|
||||
ATAPI_PROT_PIO, /* packet command, PIO data xfer*/
|
||||
ATAPI_PROT_DMA, /* packet command with special DMA sauce */
|
||||
};
|
||||
|
||||
enum ata_ioctls {
|
||||
@@ -346,8 +354,8 @@ enum ata_ioctls {
|
||||
/* core structures */
|
||||
|
||||
struct ata_prd {
|
||||
u32 addr;
|
||||
u32 flags_len;
|
||||
__le32 addr;
|
||||
__le32 flags_len;
|
||||
};
|
||||
|
||||
struct ata_taskfile {
|
||||
@@ -373,13 +381,69 @@ struct ata_taskfile {
|
||||
u8 command; /* IO operation */
|
||||
};
|
||||
|
||||
/*
|
||||
* protocol tests
|
||||
*/
|
||||
static inline unsigned int ata_prot_flags(u8 prot)
|
||||
{
|
||||
switch (prot) {
|
||||
case ATA_PROT_NODATA:
|
||||
return 0;
|
||||
case ATA_PROT_PIO:
|
||||
return ATA_PROT_FLAG_PIO;
|
||||
case ATA_PROT_DMA:
|
||||
return ATA_PROT_FLAG_DMA;
|
||||
case ATA_PROT_NCQ:
|
||||
return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
|
||||
case ATAPI_PROT_NODATA:
|
||||
return ATA_PROT_FLAG_ATAPI;
|
||||
case ATAPI_PROT_PIO:
|
||||
return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
|
||||
case ATAPI_PROT_DMA:
|
||||
return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ata_is_atapi(u8 prot)
|
||||
{
|
||||
return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
|
||||
}
|
||||
|
||||
static inline int ata_is_nodata(u8 prot)
|
||||
{
|
||||
return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
|
||||
}
|
||||
|
||||
static inline int ata_is_pio(u8 prot)
|
||||
{
|
||||
return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
|
||||
}
|
||||
|
||||
static inline int ata_is_dma(u8 prot)
|
||||
{
|
||||
return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
|
||||
}
|
||||
|
||||
static inline int ata_is_ncq(u8 prot)
|
||||
{
|
||||
return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
|
||||
}
|
||||
|
||||
static inline int ata_is_data(u8 prot)
|
||||
{
|
||||
return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
|
||||
}
|
||||
|
||||
/*
|
||||
* id tests
|
||||
*/
|
||||
#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
|
||||
#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
|
||||
#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
|
||||
#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
|
||||
#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
|
||||
#define ata_id_removeable(id) ((id)[0] & (1 << 7))
|
||||
#define ata_id_has_dword_io(id) ((id)[48] & (1 << 0))
|
||||
#define ata_id_has_atapi_AN(id) \
|
||||
( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
|
||||
((id)[78] & (1 << 5)) )
|
||||
@@ -415,6 +479,7 @@ static inline bool ata_id_has_dipm(const u16 *id)
|
||||
return val & (1 << 3);
|
||||
}
|
||||
|
||||
|
||||
static inline int ata_id_has_fua(const u16 *id)
|
||||
{
|
||||
if ((id[84] & 0xC000) != 0x4000)
|
||||
@@ -519,6 +584,26 @@ static inline int ata_id_is_sata(const u16 *id)
|
||||
return ata_id_major_version(id) >= 5 && id[93] == 0;
|
||||
}
|
||||
|
||||
static inline int ata_id_has_tpm(const u16 *id)
|
||||
{
|
||||
/* The TPM bits are only valid on ATA8 */
|
||||
if (ata_id_major_version(id) < 8)
|
||||
return 0;
|
||||
if ((id[48] & 0xC000) != 0x4000)
|
||||
return 0;
|
||||
return id[48] & (1 << 0);
|
||||
}
|
||||
|
||||
static inline int ata_id_has_dword_io(const u16 *id)
|
||||
{
|
||||
/* ATA 8 reuses this flag for "trusted" computing */
|
||||
if (ata_id_major_version(id) > 7)
|
||||
return 0;
|
||||
if (id[48] & (1 << 0))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ata_id_current_chs_valid(const u16 *id)
|
||||
{
|
||||
/* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
|
||||
@@ -574,13 +659,6 @@ static inline int atapi_command_packet_set(const u16 *dev_id)
|
||||
return (dev_id[0] >> 8) & 0x1f;
|
||||
}
|
||||
|
||||
static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
|
||||
{
|
||||
return (tf->protocol == ATA_PROT_ATAPI) ||
|
||||
(tf->protocol == ATA_PROT_ATAPI_NODATA) ||
|
||||
(tf->protocol == ATA_PROT_ATAPI_DMA);
|
||||
}
|
||||
|
||||
static inline int is_multi_taskfile(struct ata_taskfile *tf)
|
||||
{
|
||||
return (tf->command == ATA_CMD_READ_MULTI) ||
|
||||
|
@@ -14,6 +14,9 @@
|
||||
#define BR2684_MEDIA_FDDI (3)
|
||||
#define BR2684_MEDIA_802_6 (4) /* 802.6 */
|
||||
|
||||
/* used only at device creation: */
|
||||
#define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */
|
||||
|
||||
/*
|
||||
* Is there FCS inbound on this VC? This currently isn't supported.
|
||||
*/
|
||||
@@ -35,16 +38,23 @@
|
||||
#define BR2684_ENCAPS_LLC (1)
|
||||
#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */
|
||||
|
||||
/*
|
||||
* Is this VC bridged or routed?
|
||||
*/
|
||||
|
||||
#define BR2684_PAYLOAD_ROUTED (0)
|
||||
#define BR2684_PAYLOAD_BRIDGED (1)
|
||||
|
||||
/*
|
||||
* This is for the ATM_NEWBACKENDIF call - these are like socket families:
|
||||
* the first element of the structure is the backend number and the rest
|
||||
* is per-backend specific
|
||||
*/
|
||||
struct atm_newif_br2684 {
|
||||
atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
|
||||
int media; /* BR2684_MEDIA_* */
|
||||
char ifname[IFNAMSIZ];
|
||||
int mtu;
|
||||
atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
|
||||
int media; /* BR2684_MEDIA_*, flags in upper bits */
|
||||
char ifname[IFNAMSIZ];
|
||||
int mtu;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -55,10 +65,10 @@ struct atm_newif_br2684 {
|
||||
#define BR2684_FIND_BYNUM (1)
|
||||
#define BR2684_FIND_BYIFNAME (2)
|
||||
struct br2684_if_spec {
|
||||
int method; /* BR2684_FIND_* */
|
||||
int method; /* BR2684_FIND_* */
|
||||
union {
|
||||
char ifname[IFNAMSIZ];
|
||||
int devnum;
|
||||
char ifname[IFNAMSIZ];
|
||||
int devnum;
|
||||
} spec;
|
||||
};
|
||||
|
||||
@@ -68,16 +78,16 @@ struct br2684_if_spec {
|
||||
* is per-backend specific
|
||||
*/
|
||||
struct atm_backend_br2684 {
|
||||
atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
|
||||
atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
|
||||
struct br2684_if_spec ifspec;
|
||||
int fcs_in; /* BR2684_FCSIN_* */
|
||||
int fcs_out; /* BR2684_FCSOUT_* */
|
||||
int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
|
||||
int encaps; /* BR2684_ENCAPS_* */
|
||||
int has_vpiid; /* 1: use vpn_id - Unsupported */
|
||||
__u8 vpn_id[7];
|
||||
int send_padding; /* unsupported */
|
||||
int min_size; /* we will pad smaller packets than this */
|
||||
int fcs_in; /* BR2684_FCSIN_* */
|
||||
int fcs_out; /* BR2684_FCSOUT_* */
|
||||
int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
|
||||
int encaps; /* BR2684_ENCAPS_* */
|
||||
int has_vpiid; /* 1: use vpn_id - Unsupported */
|
||||
__u8 vpn_id[7];
|
||||
int send_padding; /* unsupported */
|
||||
int min_size; /* we will pad smaller packets than this */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -86,8 +96,8 @@ struct atm_backend_br2684 {
|
||||
* efficient per-if in/out filters, this support will be removed
|
||||
*/
|
||||
struct br2684_filter {
|
||||
__be32 prefix; /* network byte order */
|
||||
__be32 netmask; /* 0 = disable filter */
|
||||
__be32 prefix; /* network byte order */
|
||||
__be32 netmask; /* 0 = disable filter */
|
||||
};
|
||||
|
||||
struct br2684_filter_set {
|
||||
@@ -95,6 +105,11 @@ struct br2684_filter_set {
|
||||
struct br2684_filter filter;
|
||||
};
|
||||
|
||||
enum br2684_payload {
|
||||
p_routed = BR2684_PAYLOAD_ROUTED,
|
||||
p_bridged = BR2684_PAYLOAD_BRIDGED,
|
||||
};
|
||||
|
||||
#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
|
||||
struct br2684_filter_set)
|
||||
|
||||
|
@@ -359,7 +359,7 @@ struct atm_dev {
|
||||
struct proc_dir_entry *proc_entry; /* proc entry */
|
||||
char *proc_name; /* proc entry name */
|
||||
#endif
|
||||
struct class_device class_dev; /* sysfs class device */
|
||||
struct device class_dev; /* sysfs device */
|
||||
struct list_head dev_list; /* linkage */
|
||||
};
|
||||
|
||||
@@ -461,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
|
||||
BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
|
||||
if (dev->ops->dev_close)
|
||||
dev->ops->dev_close(dev);
|
||||
class_device_put(&dev->class_dev);
|
||||
put_device(&dev->class_dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ struct attribute_container {
|
||||
struct list_head node;
|
||||
struct klist containers;
|
||||
struct class *class;
|
||||
struct attribute_group *grp;
|
||||
struct class_device_attribute **attrs;
|
||||
int (*match)(struct attribute_container *, struct device *);
|
||||
#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
|
||||
|
@@ -115,6 +115,8 @@
|
||||
#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */
|
||||
#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */
|
||||
#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */
|
||||
#define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */
|
||||
#define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */
|
||||
|
||||
#define AUDIT_FIRST_KERN_ANOM_MSG 1700
|
||||
#define AUDIT_LAST_KERN_ANOM_MSG 1799
|
||||
|
@@ -34,83 +34,10 @@ struct sg_io_hdr;
|
||||
#define BLKDEV_MIN_RQ 4
|
||||
#define BLKDEV_MAX_RQ 128 /* Default maximum */
|
||||
|
||||
/*
|
||||
* This is the per-process anticipatory I/O scheduler state.
|
||||
*/
|
||||
struct as_io_context {
|
||||
spinlock_t lock;
|
||||
|
||||
void (*dtor)(struct as_io_context *aic); /* destructor */
|
||||
void (*exit)(struct as_io_context *aic); /* called on task exit */
|
||||
|
||||
unsigned long state;
|
||||
atomic_t nr_queued; /* queued reads & sync writes */
|
||||
atomic_t nr_dispatched; /* number of requests gone to the drivers */
|
||||
|
||||
/* IO History tracking */
|
||||
/* Thinktime */
|
||||
unsigned long last_end_request;
|
||||
unsigned long ttime_total;
|
||||
unsigned long ttime_samples;
|
||||
unsigned long ttime_mean;
|
||||
/* Layout pattern */
|
||||
unsigned int seek_samples;
|
||||
sector_t last_request_pos;
|
||||
u64 seek_total;
|
||||
sector_t seek_mean;
|
||||
};
|
||||
|
||||
struct cfq_queue;
|
||||
struct cfq_io_context {
|
||||
struct rb_node rb_node;
|
||||
void *key;
|
||||
|
||||
struct cfq_queue *cfqq[2];
|
||||
|
||||
struct io_context *ioc;
|
||||
|
||||
unsigned long last_end_request;
|
||||
sector_t last_request_pos;
|
||||
|
||||
unsigned long ttime_total;
|
||||
unsigned long ttime_samples;
|
||||
unsigned long ttime_mean;
|
||||
|
||||
unsigned int seek_samples;
|
||||
u64 seek_total;
|
||||
sector_t seek_mean;
|
||||
|
||||
struct list_head queue_list;
|
||||
|
||||
void (*dtor)(struct io_context *); /* destructor */
|
||||
void (*exit)(struct io_context *); /* called on task exit */
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the per-process I/O subsystem state. It is refcounted and
|
||||
* kmalloc'ed. Currently all fields are modified in process io context
|
||||
* (apart from the atomic refcount), so require no locking.
|
||||
*/
|
||||
struct io_context {
|
||||
atomic_t refcount;
|
||||
struct task_struct *task;
|
||||
|
||||
unsigned int ioprio_changed;
|
||||
|
||||
/*
|
||||
* For request batching
|
||||
*/
|
||||
unsigned long last_waited; /* Time last woken after wait for request */
|
||||
int nr_batch_requests; /* Number of requests left in the batch */
|
||||
|
||||
struct as_io_context *aic;
|
||||
struct rb_root cic_root;
|
||||
void *ioc_data;
|
||||
};
|
||||
|
||||
void put_io_context(struct io_context *ioc);
|
||||
int put_io_context(struct io_context *ioc);
|
||||
void exit_io_context(void);
|
||||
struct io_context *get_io_context(gfp_t gfp_flags, int node);
|
||||
struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
|
||||
void copy_io_context(struct io_context **pdst, struct io_context **psrc);
|
||||
void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
|
||||
|
||||
@@ -143,8 +70,6 @@ enum rq_cmd_type_bits {
|
||||
* use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
|
||||
* private REQ_LB opcodes to differentiate what type of request this is
|
||||
*/
|
||||
REQ_TYPE_ATA_CMD,
|
||||
REQ_TYPE_ATA_TASK,
|
||||
REQ_TYPE_ATA_TASKFILE,
|
||||
REQ_TYPE_ATA_PC,
|
||||
};
|
||||
@@ -431,6 +356,8 @@ struct request_queue
|
||||
unsigned int max_segment_size;
|
||||
|
||||
unsigned long seg_boundary_mask;
|
||||
void *dma_drain_buffer;
|
||||
unsigned int dma_drain_size;
|
||||
unsigned int dma_alignment;
|
||||
|
||||
struct blk_queue_tag *queue_tags;
|
||||
@@ -539,6 +466,8 @@ enum {
|
||||
#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
|
||||
#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
|
||||
#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
|
||||
/* rq->queuelist of dequeued request must be list_empty() */
|
||||
#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
|
||||
|
||||
#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
|
||||
|
||||
@@ -718,29 +647,32 @@ static inline void blk_run_address_space(struct address_space *mapping)
|
||||
}
|
||||
|
||||
/*
|
||||
* end_request() and friends. Must be called with the request queue spinlock
|
||||
* acquired. All functions called within end_request() _must_be_ atomic.
|
||||
* blk_end_request() and friends.
|
||||
* __blk_end_request() and end_request() must be called with
|
||||
* the request queue spinlock acquired.
|
||||
*
|
||||
* Several drivers define their own end_request and call
|
||||
* end_that_request_first() and end_that_request_last()
|
||||
* for parts of the original function. This prevents
|
||||
* code duplication in drivers.
|
||||
* blk_end_request() for parts of the original function.
|
||||
* This prevents code duplication in drivers.
|
||||
*/
|
||||
extern int end_that_request_first(struct request *, int, int);
|
||||
extern int end_that_request_chunk(struct request *, int, int);
|
||||
extern void end_that_request_last(struct request *, int);
|
||||
extern int blk_end_request(struct request *rq, int error, int nr_bytes);
|
||||
extern int __blk_end_request(struct request *rq, int error, int nr_bytes);
|
||||
extern int blk_end_bidi_request(struct request *rq, int error, int nr_bytes,
|
||||
int bidi_bytes);
|
||||
extern void end_request(struct request *, int);
|
||||
extern void end_queued_request(struct request *, int);
|
||||
extern void end_dequeued_request(struct request *, int);
|
||||
extern int blk_end_request_callback(struct request *rq, int error, int nr_bytes,
|
||||
int (drv_callback)(struct request *));
|
||||
extern void blk_complete_request(struct request *);
|
||||
|
||||
/*
|
||||
* end_that_request_first/chunk() takes an uptodate argument. we account
|
||||
* any value <= as an io error. 0 means -EIO for compatability reasons,
|
||||
* any other < 0 value is the direct error type. An uptodate value of
|
||||
* 1 indicates successful io completion
|
||||
* blk_end_request() takes bytes instead of sectors as a complete size.
|
||||
* blk_rq_bytes() returns bytes left to complete in the entire request.
|
||||
* blk_rq_cur_bytes() returns bytes left to complete in the current segment.
|
||||
*/
|
||||
#define end_io_error(uptodate) (unlikely((uptodate) <= 0))
|
||||
extern unsigned int blk_rq_bytes(struct request *rq);
|
||||
extern unsigned int blk_rq_cur_bytes(struct request *rq);
|
||||
|
||||
static inline void blkdev_dequeue_request(struct request *req)
|
||||
{
|
||||
@@ -762,10 +694,13 @@ extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
|
||||
extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
|
||||
extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
|
||||
extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
|
||||
extern int blk_queue_dma_drain(struct request_queue *q, void *buf,
|
||||
unsigned int size);
|
||||
extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
|
||||
extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
|
||||
extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
|
||||
extern void blk_queue_dma_alignment(struct request_queue *, int);
|
||||
extern void blk_queue_update_dma_alignment(struct request_queue *, int);
|
||||
extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
|
||||
extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
|
||||
extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *);
|
||||
@@ -837,12 +772,7 @@ static inline int bdev_hardsect_size(struct block_device *bdev)
|
||||
|
||||
static inline int queue_dma_alignment(struct request_queue *q)
|
||||
{
|
||||
int retval = 511;
|
||||
|
||||
if (q && q->dma_alignment)
|
||||
retval = q->dma_alignment;
|
||||
|
||||
return retval;
|
||||
return q ? q->dma_alignment : 511;
|
||||
}
|
||||
|
||||
/* assumes size > 256 */
|
||||
@@ -895,6 +825,13 @@ static inline void exit_io_context(void)
|
||||
{
|
||||
}
|
||||
|
||||
struct io_context;
|
||||
static inline int put_io_context(struct io_context *ioc)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_BLOCK */
|
||||
|
||||
#endif
|
||||
|
@@ -148,7 +148,7 @@ extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
|
||||
extern void blk_trace_shutdown(struct request_queue *);
|
||||
extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
|
||||
extern int do_blk_trace_setup(struct request_queue *q,
|
||||
struct block_device *bdev, struct blk_user_trace_setup *buts);
|
||||
char *name, dev_t dev, struct blk_user_trace_setup *buts);
|
||||
|
||||
|
||||
/**
|
||||
@@ -282,6 +282,11 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
|
||||
__blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
|
||||
}
|
||||
|
||||
extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
|
||||
char __user *arg);
|
||||
extern int blk_trace_startstop(struct request_queue *q, int start);
|
||||
extern int blk_trace_remove(struct request_queue *q);
|
||||
|
||||
#else /* !CONFIG_BLK_DEV_IO_TRACE */
|
||||
#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
|
||||
#define blk_trace_shutdown(q) do { } while (0)
|
||||
@@ -290,7 +295,10 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
|
||||
#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
|
||||
#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
|
||||
#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
|
||||
#define do_blk_trace_setup(q, bdev, buts) (-ENOTTY)
|
||||
#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY)
|
||||
#define blk_trace_setup(q, name, dev, arg) (-ENOTTY)
|
||||
#define blk_trace_startstop(q, start) (-ENOTTY)
|
||||
#define blk_trace_remove(q) (-ENOTTY)
|
||||
#endif /* CONFIG_BLK_DEV_IO_TRACE */
|
||||
#endif /* __KERNEL__ */
|
||||
#endif
|
||||
|
@@ -192,6 +192,8 @@ int sync_dirty_buffer(struct buffer_head *bh);
|
||||
int submit_bh(int, struct buffer_head *);
|
||||
void write_boundary_block(struct block_device *bdev,
|
||||
sector_t bblock, unsigned blocksize);
|
||||
int bh_uptodate_or_lock(struct buffer_head *bh);
|
||||
int bh_submit_read(struct buffer_head *bh);
|
||||
|
||||
extern int buffer_heads_over_limit;
|
||||
|
||||
|
111
include/linux/can.h
Normal file
111
include/linux/can.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* linux/can.h
|
||||
*
|
||||
* Definitions for CAN network layer (socket addr / CAN frame / CAN filter)
|
||||
*
|
||||
* Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
|
||||
* Urs Thuermann <urs.thuermann@volkswagen.de>
|
||||
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
|
||||
* All rights reserved.
|
||||
*
|
||||
* Send feedback to <socketcan-users@lists.berlios.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CAN_H
|
||||
#define CAN_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/socket.h>
|
||||
|
||||
/* controller area network (CAN) kernel definitions */
|
||||
|
||||
/* special address description flags for the CAN_ID */
|
||||
#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
|
||||
#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */
|
||||
#define CAN_ERR_FLAG 0x20000000U /* error frame */
|
||||
|
||||
/* valid bits in CAN ID for frame formats */
|
||||
#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */
|
||||
#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */
|
||||
#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */
|
||||
|
||||
/*
|
||||
* Controller Area Network Identifier structure
|
||||
*
|
||||
* bit 0-28 : CAN identifier (11/29 bit)
|
||||
* bit 29 : error frame flag (0 = data frame, 1 = error frame)
|
||||
* bit 30 : remote transmission request flag (1 = rtr frame)
|
||||
* bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)
|
||||
*/
|
||||
typedef __u32 canid_t;
|
||||
|
||||
/*
|
||||
* Controller Area Network Error Frame Mask structure
|
||||
*
|
||||
* bit 0-28 : error class mask (see include/linux/can/error.h)
|
||||
* bit 29-31 : set to zero
|
||||
*/
|
||||
typedef __u32 can_err_mask_t;
|
||||
|
||||
/**
|
||||
* struct can_frame - basic CAN frame structure
|
||||
* @can_id: the CAN ID of the frame and CAN_*_FLAG flags, see above.
|
||||
* @can_dlc: the data length field of the CAN frame
|
||||
* @data: the CAN frame payload.
|
||||
*/
|
||||
struct can_frame {
|
||||
canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
|
||||
__u8 can_dlc; /* data length code: 0 .. 8 */
|
||||
__u8 data[8] __attribute__((aligned(8)));
|
||||
};
|
||||
|
||||
/* particular protocols of the protocol family PF_CAN */
|
||||
#define CAN_RAW 1 /* RAW sockets */
|
||||
#define CAN_BCM 2 /* Broadcast Manager */
|
||||
#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */
|
||||
#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */
|
||||
#define CAN_MCNET 5 /* Bosch MCNet */
|
||||
#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */
|
||||
#define CAN_NPROTO 7
|
||||
|
||||
#define SOL_CAN_BASE 100
|
||||
|
||||
/**
|
||||
* struct sockaddr_can - the sockaddr structure for CAN sockets
|
||||
* @can_family: address family number AF_CAN.
|
||||
* @can_ifindex: CAN network interface index.
|
||||
* @can_addr: protocol specific address information
|
||||
*/
|
||||
struct sockaddr_can {
|
||||
sa_family_t can_family;
|
||||
int can_ifindex;
|
||||
union {
|
||||
/* transport protocol class address information (e.g. ISOTP) */
|
||||
struct { canid_t rx_id, tx_id; } tp;
|
||||
|
||||
/* reserved for future CAN protocols address information */
|
||||
} can_addr;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct can_filter - CAN ID based filter in can_register().
|
||||
* @can_id: relevant bits of CAN ID which are not masked out.
|
||||
* @can_mask: CAN mask (see description)
|
||||
*
|
||||
* Description:
|
||||
* A filter matches, when
|
||||
*
|
||||
* <received_can_id> & mask == can_id & mask
|
||||
*
|
||||
* The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
|
||||
* filter for error frames (CAN_ERR_FLAG bit set in mask).
|
||||
*/
|
||||
struct can_filter {
|
||||
canid_t can_id;
|
||||
canid_t can_mask;
|
||||
};
|
||||
|
||||
#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */
|
||||
|
||||
#endif /* CAN_H */
|
3
include/linux/can/Kbuild
Normal file
3
include/linux/can/Kbuild
Normal file
@@ -0,0 +1,3 @@
|
||||
header-y += raw.h
|
||||
header-y += bcm.h
|
||||
header-y += error.h
|
65
include/linux/can/bcm.h
Normal file
65
include/linux/can/bcm.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* linux/can/bcm.h
|
||||
*
|
||||
* Definitions for CAN Broadcast Manager (BCM)
|
||||
*
|
||||
* Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
|
||||
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
|
||||
* All rights reserved.
|
||||
*
|
||||
* Send feedback to <socketcan-users@lists.berlios.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CAN_BCM_H
|
||||
#define CAN_BCM_H
|
||||
|
||||
/**
|
||||
* struct bcm_msg_head - head of messages to/from the broadcast manager
|
||||
* @opcode: opcode, see enum below.
|
||||
* @flags: special flags, see below.
|
||||
* @count: number of frames to send before changing interval.
|
||||
* @ival1: interval for the first @count frames.
|
||||
* @ival2: interval for the following frames.
|
||||
* @can_id: CAN ID of frames to be sent or received.
|
||||
* @nframes: number of frames appended to the message head.
|
||||
* @frames: array of CAN frames.
|
||||
*/
|
||||
struct bcm_msg_head {
|
||||
__u32 opcode;
|
||||
__u32 flags;
|
||||
__u32 count;
|
||||
struct timeval ival1, ival2;
|
||||
canid_t can_id;
|
||||
__u32 nframes;
|
||||
struct can_frame frames[0];
|
||||
};
|
||||
|
||||
enum {
|
||||
TX_SETUP = 1, /* create (cyclic) transmission task */
|
||||
TX_DELETE, /* remove (cyclic) transmission task */
|
||||
TX_READ, /* read properties of (cyclic) transmission task */
|
||||
TX_SEND, /* send one CAN frame */
|
||||
RX_SETUP, /* create RX content filter subscription */
|
||||
RX_DELETE, /* remove RX content filter subscription */
|
||||
RX_READ, /* read properties of RX content filter subscription */
|
||||
TX_STATUS, /* reply to TX_READ request */
|
||||
TX_EXPIRED, /* notification on performed transmissions (count=0) */
|
||||
RX_STATUS, /* reply to RX_READ request */
|
||||
RX_TIMEOUT, /* cyclic message is absent */
|
||||
RX_CHANGED /* updated CAN frame (detected content change) */
|
||||
};
|
||||
|
||||
#define SETTIMER 0x0001
|
||||
#define STARTTIMER 0x0002
|
||||
#define TX_COUNTEVT 0x0004
|
||||
#define TX_ANNOUNCE 0x0008
|
||||
#define TX_CP_CAN_ID 0x0010
|
||||
#define RX_FILTER_ID 0x0020
|
||||
#define RX_CHECK_DLC 0x0040
|
||||
#define RX_NO_AUTOTIMER 0x0080
|
||||
#define RX_ANNOUNCE_RESUME 0x0100
|
||||
#define TX_RESET_MULTI_IDX 0x0200
|
||||
#define RX_RTR_FRAME 0x0400
|
||||
|
||||
#endif /* CAN_BCM_H */
|
64
include/linux/can/core.h
Normal file
64
include/linux/can/core.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* linux/can/core.h
|
||||
*
|
||||
* Protoypes and definitions for CAN protocol modules using the PF_CAN core
|
||||
*
|
||||
* Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
|
||||
* Urs Thuermann <urs.thuermann@volkswagen.de>
|
||||
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
|
||||
* All rights reserved.
|
||||
*
|
||||
* Send feedback to <socketcan-users@lists.berlios.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CAN_CORE_H
|
||||
#define CAN_CORE_H
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
#define CAN_VERSION "20071116"
|
||||
|
||||
/* increment this number each time you change some user-space interface */
|
||||
#define CAN_ABI_VERSION "8"
|
||||
|
||||
#define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION
|
||||
|
||||
#define DNAME(dev) ((dev) ? (dev)->name : "any")
|
||||
|
||||
/**
|
||||
* struct can_proto - CAN protocol structure
|
||||
* @type: type argument in socket() syscall, e.g. SOCK_DGRAM.
|
||||
* @protocol: protocol number in socket() syscall.
|
||||
* @capability: capability needed to open the socket, or -1 for no restriction.
|
||||
* @ops: pointer to struct proto_ops for sock->ops.
|
||||
* @prot: pointer to struct proto structure.
|
||||
*/
|
||||
struct can_proto {
|
||||
int type;
|
||||
int protocol;
|
||||
int capability;
|
||||
struct proto_ops *ops;
|
||||
struct proto *prot;
|
||||
};
|
||||
|
||||
/* function prototypes for the CAN networklayer core (af_can.c) */
|
||||
|
||||
extern int can_proto_register(struct can_proto *cp);
|
||||
extern void can_proto_unregister(struct can_proto *cp);
|
||||
|
||||
extern int can_rx_register(struct net_device *dev, canid_t can_id,
|
||||
canid_t mask,
|
||||
void (*func)(struct sk_buff *, void *),
|
||||
void *data, char *ident);
|
||||
|
||||
extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
|
||||
canid_t mask,
|
||||
void (*func)(struct sk_buff *, void *),
|
||||
void *data);
|
||||
|
||||
extern int can_send(struct sk_buff *skb, int loop);
|
||||
|
||||
#endif /* CAN_CORE_H */
|
93
include/linux/can/error.h
Normal file
93
include/linux/can/error.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* linux/can/error.h
|
||||
*
|
||||
* Definitions of the CAN error frame to be filtered and passed to the user.
|
||||
*
|
||||
* Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
|
||||
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
|
||||
* All rights reserved.
|
||||
*
|
||||
* Send feedback to <socketcan-users@lists.berlios.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CAN_ERROR_H
|
||||
#define CAN_ERROR_H
|
||||
|
||||
#define CAN_ERR_DLC 8 /* dlc for error frames */
|
||||
|
||||
/* error class (mask) in can_id */
|
||||
#define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */
|
||||
#define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */
|
||||
#define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */
|
||||
#define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */
|
||||
#define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */
|
||||
#define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */
|
||||
#define CAN_ERR_BUSOFF 0x00000040U /* bus off */
|
||||
#define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */
|
||||
#define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */
|
||||
|
||||
/* arbitration lost in bit ... / data[0] */
|
||||
#define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */
|
||||
/* else bit number in bitstream */
|
||||
|
||||
/* error status of CAN-controller / data[1] */
|
||||
#define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */
|
||||
#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */
|
||||
#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */
|
||||
#define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */
|
||||
#define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */
|
||||
#define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */
|
||||
#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */
|
||||
/* (at least one error counter exceeds */
|
||||
/* the protocol-defined level of 127) */
|
||||
|
||||
/* error in CAN protocol (type) / data[2] */
|
||||
#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */
|
||||
#define CAN_ERR_PROT_BIT 0x01 /* single bit error */
|
||||
#define CAN_ERR_PROT_FORM 0x02 /* frame format error */
|
||||
#define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */
|
||||
#define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */
|
||||
#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */
|
||||
#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */
|
||||
#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */
|
||||
#define CAN_ERR_PROT_TX 0x80 /* error occured on transmission */
|
||||
|
||||
/* error in CAN protocol (location) / data[3] */
|
||||
#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */
|
||||
#define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */
|
||||
#define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */
|
||||
#define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/
|
||||
#define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */
|
||||
#define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */
|
||||
#define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */
|
||||
#define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */
|
||||
#define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */
|
||||
#define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */
|
||||
#define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */
|
||||
#define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */
|
||||
#define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */
|
||||
#define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */
|
||||
#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */
|
||||
#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */
|
||||
#define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */
|
||||
#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */
|
||||
#define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */
|
||||
#define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */
|
||||
|
||||
/* error status of CAN-transceiver / data[4] */
|
||||
/* CANH CANL */
|
||||
#define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */
|
||||
#define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */
|
||||
#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */
|
||||
#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */
|
||||
#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */
|
||||
#define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */
|
||||
#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */
|
||||
#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */
|
||||
#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */
|
||||
#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */
|
||||
|
||||
/* controller specific additional information / data[5..7] */
|
||||
|
||||
#endif /* CAN_ERROR_H */
|
31
include/linux/can/raw.h
Normal file
31
include/linux/can/raw.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* linux/can/raw.h
|
||||
*
|
||||
* Definitions for raw CAN sockets
|
||||
*
|
||||
* Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
|
||||
* Urs Thuermann <urs.thuermann@volkswagen.de>
|
||||
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
|
||||
* All rights reserved.
|
||||
*
|
||||
* Send feedback to <socketcan-users@lists.berlios.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CAN_RAW_H
|
||||
#define CAN_RAW_H
|
||||
|
||||
#include <linux/can.h>
|
||||
|
||||
#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
|
||||
|
||||
/* for socket options affecting the socket (not the global system) */
|
||||
|
||||
enum {
|
||||
CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */
|
||||
CAN_RAW_ERR_FILTER, /* set filter for error frames */
|
||||
CAN_RAW_LOOPBACK, /* local loopback (default:on) */
|
||||
CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */
|
||||
};
|
||||
|
||||
#endif
|
@@ -451,6 +451,7 @@ struct cdrom_generic_command
|
||||
#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
|
||||
#define GPCMD_READ_10 0x28
|
||||
#define GPCMD_READ_12 0xa8
|
||||
#define GPCMD_READ_BUFFER 0x3c
|
||||
#define GPCMD_READ_BUFFER_CAPACITY 0x5c
|
||||
#define GPCMD_READ_CDVD_CAPACITY 0x25
|
||||
#define GPCMD_READ_CD 0xbe
|
||||
@@ -480,7 +481,9 @@ struct cdrom_generic_command
|
||||
#define GPCMD_TEST_UNIT_READY 0x00
|
||||
#define GPCMD_VERIFY_10 0x2f
|
||||
#define GPCMD_WRITE_10 0x2a
|
||||
#define GPCMD_WRITE_12 0xaa
|
||||
#define GPCMD_WRITE_AND_VERIFY_10 0x2e
|
||||
#define GPCMD_WRITE_BUFFER 0x3b
|
||||
/* This is listed as optional in ATAPI 2.6, but is (curiously)
|
||||
* missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
|
||||
* Table 377 as an MMC command for SCSi devices though... Most ATAPI
|
||||
|
@@ -103,7 +103,7 @@ struct clocksource {
|
||||
#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
|
||||
|
||||
/* simplify initialization of mask field */
|
||||
#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
|
||||
#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
|
||||
|
||||
/**
|
||||
* clocksource_khz2mult - calculates mult from khz and shift
|
||||
@@ -215,6 +215,7 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
|
||||
|
||||
/* used to install a new clocksource */
|
||||
extern int clocksource_register(struct clocksource*);
|
||||
extern void clocksource_unregister(struct clocksource*);
|
||||
extern struct clocksource* clocksource_get_next(void);
|
||||
extern void clocksource_change_rating(struct clocksource *cs, int rating);
|
||||
extern void clocksource_resume(void);
|
||||
|
@@ -191,6 +191,10 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
|
||||
compat_ulong_t __user *outp, compat_ulong_t __user *exp,
|
||||
struct compat_timeval __user *tvp);
|
||||
|
||||
asmlinkage long compat_sys_wait4(compat_pid_t pid,
|
||||
compat_uint_t *stat_addr, int options,
|
||||
struct compat_rusage *ru);
|
||||
|
||||
#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
|
||||
|
||||
#define BITS_TO_COMPAT_LONGS(bits) \
|
||||
@@ -239,6 +243,17 @@ asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
|
||||
compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
|
||||
const compat_ulong_t __user *new_nodes);
|
||||
|
||||
extern int compat_ptrace_request(struct task_struct *child,
|
||||
compat_long_t request,
|
||||
compat_ulong_t addr, compat_ulong_t data);
|
||||
|
||||
#ifdef __ARCH_WANT_COMPAT_SYS_PTRACE
|
||||
extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
|
||||
compat_ulong_t addr, compat_ulong_t data);
|
||||
asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
|
||||
compat_long_t addr, compat_long_t data);
|
||||
#endif /* __ARCH_WANT_COMPAT_SYS_PTRACE */
|
||||
|
||||
/*
|
||||
* epoll (fs/eventpoll.c) compat bits follow ...
|
||||
*/
|
||||
|
@@ -7,10 +7,8 @@
|
||||
|
||||
#if __GNUC_MINOR__ >= 3
|
||||
# define __used __attribute__((__used__))
|
||||
# define __attribute_used__ __used /* deprecated */
|
||||
#else
|
||||
# define __used __attribute__((__unused__))
|
||||
# define __attribute_used__ __used /* deprecated */
|
||||
#endif
|
||||
|
||||
#if __GNUC_MINOR__ >= 4
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#endif
|
||||
|
||||
#define __used __attribute__((__used__))
|
||||
#define __attribute_used__ __used /* deprecated */
|
||||
#define __must_check __attribute__((warn_unused_result))
|
||||
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
|
||||
#define __always_inline inline __attribute__((always_inline))
|
||||
|
@@ -126,10 +126,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
|
||||
* Mark functions that are referenced only in inline assembly as __used so
|
||||
* the code is emitted even though it appears to be unreferenced.
|
||||
*/
|
||||
#ifndef __attribute_used__
|
||||
# define __attribute_used__ /* deprecated */
|
||||
#endif
|
||||
|
||||
#ifndef __used
|
||||
# define __used /* unimplemented */
|
||||
#endif
|
||||
@@ -175,4 +171,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
|
||||
#define __cold
|
||||
#endif
|
||||
|
||||
/* Simple shorthand for a section definition */
|
||||
#ifndef __section
|
||||
# define __section(S) __attribute__ ((__section__(#S)))
|
||||
#endif
|
||||
|
||||
#endif /* __LINUX_COMPILER_H */
|
||||
|
@@ -112,7 +112,6 @@ struct cn_queue_dev {
|
||||
struct list_head queue_list;
|
||||
spinlock_t queue_lock;
|
||||
|
||||
int netlink_groups;
|
||||
struct sock *nls;
|
||||
};
|
||||
|
||||
@@ -133,15 +132,13 @@ struct cn_callback_data {
|
||||
|
||||
struct cn_callback_entry {
|
||||
struct list_head callback_entry;
|
||||
struct cn_callback *cb;
|
||||
struct work_struct work;
|
||||
struct cn_queue_dev *pdev;
|
||||
|
||||
struct cn_callback_id id;
|
||||
struct cn_callback_data data;
|
||||
|
||||
int seq, group;
|
||||
struct sock *nls;
|
||||
u32 seq, group;
|
||||
};
|
||||
|
||||
struct cn_ctl_entry {
|
||||
|
@@ -7,13 +7,18 @@
|
||||
* C code. Therefore we cannot annotate them always with
|
||||
* 'UL' and other type specifiers unilaterally. We
|
||||
* use the following macros to deal with this.
|
||||
*
|
||||
* Similarly, _AT() will cast an expression with a type in C, but
|
||||
* leave it unchanged in asm.
|
||||
*/
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
#define _AC(X,Y) X
|
||||
#define _AT(T,X) X
|
||||
#else
|
||||
#define __AC(X,Y) (X##Y)
|
||||
#define _AC(X,Y) __AC(X,Y)
|
||||
#define _AT(T,X) ((T)(X))
|
||||
#endif
|
||||
|
||||
#endif /* !(_LINUX_CONST_H) */
|
||||
|
@@ -71,18 +71,27 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
|
||||
|
||||
int cpu_up(unsigned int cpu);
|
||||
|
||||
extern void cpu_hotplug_init(void);
|
||||
|
||||
#else
|
||||
|
||||
static inline int register_cpu_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void unregister_cpu_notifier(struct notifier_block *nb)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void cpu_hotplug_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
extern struct sysdev_class cpu_sysdev_class;
|
||||
extern void cpu_maps_update_begin(void);
|
||||
extern void cpu_maps_update_done(void);
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
/* Stop CPUs going up and down. */
|
||||
@@ -97,8 +106,8 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
|
||||
mutex_unlock(cpu_hp_mutex);
|
||||
}
|
||||
|
||||
extern void lock_cpu_hotplug(void);
|
||||
extern void unlock_cpu_hotplug(void);
|
||||
extern void get_online_cpus(void);
|
||||
extern void put_online_cpus(void);
|
||||
#define hotcpu_notifier(fn, pri) { \
|
||||
static struct notifier_block fn##_nb = \
|
||||
{ .notifier_call = fn, .priority = pri }; \
|
||||
@@ -115,8 +124,8 @@ static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
|
||||
static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
|
||||
{ }
|
||||
|
||||
#define lock_cpu_hotplug() do { } while (0)
|
||||
#define unlock_cpu_hotplug() do { } while (0)
|
||||
#define get_online_cpus() do { } while (0)
|
||||
#define put_online_cpus() do { } while (0)
|
||||
#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
|
||||
/* These aren't inline functions due to a GCC bug. */
|
||||
#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
|
||||
|
@@ -218,8 +218,8 @@ int __first_cpu(const cpumask_t *srcp);
|
||||
int __next_cpu(int n, const cpumask_t *srcp);
|
||||
#define next_cpu(n, src) __next_cpu((n), &(src))
|
||||
#else
|
||||
#define first_cpu(src) 0
|
||||
#define next_cpu(n, src) 1
|
||||
#define first_cpu(src) ({ (void)(src); 0; })
|
||||
#define next_cpu(n, src) ({ (void)(src); 1; })
|
||||
#endif
|
||||
|
||||
#define cpumask_of_cpu(cpu) \
|
||||
|
@@ -33,10 +33,13 @@
|
||||
#define CRYPTO_ALG_TYPE_DIGEST 0x00000002
|
||||
#define CRYPTO_ALG_TYPE_HASH 0x00000003
|
||||
#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
|
||||
#define CRYPTO_ALG_TYPE_COMPRESS 0x00000005
|
||||
#define CRYPTO_ALG_TYPE_AEAD 0x00000006
|
||||
#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
|
||||
#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
|
||||
#define CRYPTO_ALG_TYPE_COMPRESS 0x00000008
|
||||
#define CRYPTO_ALG_TYPE_AEAD 0x00000009
|
||||
|
||||
#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
|
||||
#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c
|
||||
|
||||
#define CRYPTO_ALG_LARVAL 0x00000010
|
||||
#define CRYPTO_ALG_DEAD 0x00000020
|
||||
@@ -49,6 +52,12 @@
|
||||
*/
|
||||
#define CRYPTO_ALG_NEED_FALLBACK 0x00000100
|
||||
|
||||
/*
|
||||
* This bit is set for symmetric key ciphers that have already been wrapped
|
||||
* with a generic IV generator to prevent them from being wrapped again.
|
||||
*/
|
||||
#define CRYPTO_ALG_GENIV 0x00000200
|
||||
|
||||
/*
|
||||
* Transform masks and values (for crt_flags).
|
||||
*/
|
||||
@@ -81,13 +90,11 @@
|
||||
#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
|
||||
#elif defined(ARCH_SLAB_MINALIGN)
|
||||
#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
|
||||
#else
|
||||
#define CRYPTO_MINALIGN __alignof__(unsigned long long)
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTO_MINALIGN
|
||||
#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
|
||||
#else
|
||||
#define CRYPTO_MINALIGN_ATTR
|
||||
#endif
|
||||
|
||||
struct scatterlist;
|
||||
struct crypto_ablkcipher;
|
||||
@@ -97,6 +104,8 @@ struct crypto_blkcipher;
|
||||
struct crypto_hash;
|
||||
struct crypto_tfm;
|
||||
struct crypto_type;
|
||||
struct aead_givcrypt_request;
|
||||
struct skcipher_givcrypt_request;
|
||||
|
||||
typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
|
||||
|
||||
@@ -176,6 +185,10 @@ struct ablkcipher_alg {
|
||||
unsigned int keylen);
|
||||
int (*encrypt)(struct ablkcipher_request *req);
|
||||
int (*decrypt)(struct ablkcipher_request *req);
|
||||
int (*givencrypt)(struct skcipher_givcrypt_request *req);
|
||||
int (*givdecrypt)(struct skcipher_givcrypt_request *req);
|
||||
|
||||
const char *geniv;
|
||||
|
||||
unsigned int min_keysize;
|
||||
unsigned int max_keysize;
|
||||
@@ -185,11 +198,16 @@ struct ablkcipher_alg {
|
||||
struct aead_alg {
|
||||
int (*setkey)(struct crypto_aead *tfm, const u8 *key,
|
||||
unsigned int keylen);
|
||||
int (*setauthsize)(struct crypto_aead *tfm, unsigned int authsize);
|
||||
int (*encrypt)(struct aead_request *req);
|
||||
int (*decrypt)(struct aead_request *req);
|
||||
int (*givencrypt)(struct aead_givcrypt_request *req);
|
||||
int (*givdecrypt)(struct aead_givcrypt_request *req);
|
||||
|
||||
const char *geniv;
|
||||
|
||||
unsigned int ivsize;
|
||||
unsigned int authsize;
|
||||
unsigned int maxauthsize;
|
||||
};
|
||||
|
||||
struct blkcipher_alg {
|
||||
@@ -202,6 +220,8 @@ struct blkcipher_alg {
|
||||
struct scatterlist *dst, struct scatterlist *src,
|
||||
unsigned int nbytes);
|
||||
|
||||
const char *geniv;
|
||||
|
||||
unsigned int min_keysize;
|
||||
unsigned int max_keysize;
|
||||
unsigned int ivsize;
|
||||
@@ -317,6 +337,11 @@ struct ablkcipher_tfm {
|
||||
unsigned int keylen);
|
||||
int (*encrypt)(struct ablkcipher_request *req);
|
||||
int (*decrypt)(struct ablkcipher_request *req);
|
||||
int (*givencrypt)(struct skcipher_givcrypt_request *req);
|
||||
int (*givdecrypt)(struct skcipher_givcrypt_request *req);
|
||||
|
||||
struct crypto_ablkcipher *base;
|
||||
|
||||
unsigned int ivsize;
|
||||
unsigned int reqsize;
|
||||
};
|
||||
@@ -326,6 +351,11 @@ struct aead_tfm {
|
||||
unsigned int keylen);
|
||||
int (*encrypt)(struct aead_request *req);
|
||||
int (*decrypt)(struct aead_request *req);
|
||||
int (*givencrypt)(struct aead_givcrypt_request *req);
|
||||
int (*givdecrypt)(struct aead_givcrypt_request *req);
|
||||
|
||||
struct crypto_aead *base;
|
||||
|
||||
unsigned int ivsize;
|
||||
unsigned int authsize;
|
||||
unsigned int reqsize;
|
||||
@@ -525,17 +555,23 @@ static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast(
|
||||
return (struct crypto_ablkcipher *)tfm;
|
||||
}
|
||||
|
||||
static inline struct crypto_ablkcipher *crypto_alloc_ablkcipher(
|
||||
const char *alg_name, u32 type, u32 mask)
|
||||
static inline u32 crypto_skcipher_type(u32 type)
|
||||
{
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
|
||||
type |= CRYPTO_ALG_TYPE_BLKCIPHER;
|
||||
mask |= CRYPTO_ALG_TYPE_MASK;
|
||||
|
||||
return __crypto_ablkcipher_cast(
|
||||
crypto_alloc_base(alg_name, type, mask));
|
||||
return type;
|
||||
}
|
||||
|
||||
static inline u32 crypto_skcipher_mask(u32 mask)
|
||||
{
|
||||
mask &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
|
||||
mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
|
||||
return mask;
|
||||
}
|
||||
|
||||
struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name,
|
||||
u32 type, u32 mask);
|
||||
|
||||
static inline struct crypto_tfm *crypto_ablkcipher_tfm(
|
||||
struct crypto_ablkcipher *tfm)
|
||||
{
|
||||
@@ -550,11 +586,8 @@ static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
|
||||
static inline int crypto_has_ablkcipher(const char *alg_name, u32 type,
|
||||
u32 mask)
|
||||
{
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
type |= CRYPTO_ALG_TYPE_BLKCIPHER;
|
||||
mask |= CRYPTO_ALG_TYPE_MASK;
|
||||
|
||||
return crypto_has_alg(alg_name, type, mask);
|
||||
return crypto_has_alg(alg_name, crypto_skcipher_type(type),
|
||||
crypto_skcipher_mask(mask));
|
||||
}
|
||||
|
||||
static inline struct ablkcipher_tfm *crypto_ablkcipher_crt(
|
||||
@@ -601,7 +634,9 @@ static inline void crypto_ablkcipher_clear_flags(struct crypto_ablkcipher *tfm,
|
||||
static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
|
||||
const u8 *key, unsigned int keylen)
|
||||
{
|
||||
return crypto_ablkcipher_crt(tfm)->setkey(tfm, key, keylen);
|
||||
struct ablkcipher_tfm *crt = crypto_ablkcipher_crt(tfm);
|
||||
|
||||
return crt->setkey(crt->base, key, keylen);
|
||||
}
|
||||
|
||||
static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm(
|
||||
@@ -633,7 +668,7 @@ static inline unsigned int crypto_ablkcipher_reqsize(
|
||||
static inline void ablkcipher_request_set_tfm(
|
||||
struct ablkcipher_request *req, struct crypto_ablkcipher *tfm)
|
||||
{
|
||||
req->base.tfm = crypto_ablkcipher_tfm(tfm);
|
||||
req->base.tfm = crypto_ablkcipher_tfm(crypto_ablkcipher_crt(tfm)->base);
|
||||
}
|
||||
|
||||
static inline struct ablkcipher_request *ablkcipher_request_cast(
|
||||
@@ -686,15 +721,7 @@ static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm)
|
||||
return (struct crypto_aead *)tfm;
|
||||
}
|
||||
|
||||
static inline struct crypto_aead *crypto_alloc_aead(const char *alg_name,
|
||||
u32 type, u32 mask)
|
||||
{
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
type |= CRYPTO_ALG_TYPE_AEAD;
|
||||
mask |= CRYPTO_ALG_TYPE_MASK;
|
||||
|
||||
return __crypto_aead_cast(crypto_alloc_base(alg_name, type, mask));
|
||||
}
|
||||
struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask);
|
||||
|
||||
static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)
|
||||
{
|
||||
@@ -749,9 +776,13 @@ static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
|
||||
static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
|
||||
unsigned int keylen)
|
||||
{
|
||||
return crypto_aead_crt(tfm)->setkey(tfm, key, keylen);
|
||||
struct aead_tfm *crt = crypto_aead_crt(tfm);
|
||||
|
||||
return crt->setkey(crt->base, key, keylen);
|
||||
}
|
||||
|
||||
int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
|
||||
|
||||
static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
|
||||
{
|
||||
return __crypto_aead_cast(req->base.tfm);
|
||||
@@ -775,7 +806,7 @@ static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm)
|
||||
static inline void aead_request_set_tfm(struct aead_request *req,
|
||||
struct crypto_aead *tfm)
|
||||
{
|
||||
req->base.tfm = crypto_aead_tfm(tfm);
|
||||
req->base.tfm = crypto_aead_tfm(crypto_aead_crt(tfm)->base);
|
||||
}
|
||||
|
||||
static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
|
||||
@@ -841,9 +872,9 @@ static inline struct crypto_blkcipher *crypto_blkcipher_cast(
|
||||
static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
|
||||
const char *alg_name, u32 type, u32 mask)
|
||||
{
|
||||
type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC);
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
type |= CRYPTO_ALG_TYPE_BLKCIPHER;
|
||||
mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC;
|
||||
mask |= CRYPTO_ALG_TYPE_MASK;
|
||||
|
||||
return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask));
|
||||
}
|
||||
@@ -861,9 +892,9 @@ static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
|
||||
|
||||
static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
|
||||
{
|
||||
type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC);
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
type |= CRYPTO_ALG_TYPE_BLKCIPHER;
|
||||
mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC;
|
||||
mask |= CRYPTO_ALG_TYPE_MASK;
|
||||
|
||||
return crypto_has_alg(alg_name, type, mask);
|
||||
}
|
||||
@@ -1081,6 +1112,7 @@ static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
|
||||
u32 type, u32 mask)
|
||||
{
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
mask &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
type |= CRYPTO_ALG_TYPE_HASH;
|
||||
mask |= CRYPTO_ALG_TYPE_HASH_MASK;
|
||||
|
||||
@@ -1100,6 +1132,7 @@ static inline void crypto_free_hash(struct crypto_hash *tfm)
|
||||
static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask)
|
||||
{
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
mask &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
type |= CRYPTO_ALG_TYPE_HASH;
|
||||
mask |= CRYPTO_ALG_TYPE_HASH_MASK;
|
||||
|
||||
|
@@ -205,6 +205,7 @@ struct dccp_so_feat {
|
||||
#define DCCP_SOCKOPT_CHANGE_L 3
|
||||
#define DCCP_SOCKOPT_CHANGE_R 4
|
||||
#define DCCP_SOCKOPT_GET_CUR_MPS 5
|
||||
#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
|
||||
#define DCCP_SOCKOPT_SEND_CSCOV 10
|
||||
#define DCCP_SOCKOPT_RECV_CSCOV 11
|
||||
#define DCCP_SOCKOPT_CCID_RX_INFO 128
|
||||
@@ -227,37 +228,50 @@ struct dccp_so_feat {
|
||||
#include <net/tcp_states.h>
|
||||
|
||||
enum dccp_state {
|
||||
DCCP_OPEN = TCP_ESTABLISHED,
|
||||
DCCP_REQUESTING = TCP_SYN_SENT,
|
||||
DCCP_PARTOPEN = TCP_FIN_WAIT1, /* FIXME:
|
||||
This mapping is horrible, but TCP has
|
||||
no matching state for DCCP_PARTOPEN,
|
||||
as TCP_SYN_RECV is already used by
|
||||
DCCP_RESPOND, why don't stop using TCP
|
||||
mapping of states? OK, now we don't use
|
||||
sk_stream_sendmsg anymore, so doesn't
|
||||
seem to exist any reason for us to
|
||||
do the TCP mapping here */
|
||||
DCCP_LISTEN = TCP_LISTEN,
|
||||
DCCP_RESPOND = TCP_SYN_RECV,
|
||||
DCCP_CLOSING = TCP_CLOSING,
|
||||
DCCP_TIME_WAIT = TCP_TIME_WAIT,
|
||||
DCCP_CLOSED = TCP_CLOSE,
|
||||
DCCP_MAX_STATES = TCP_MAX_STATES,
|
||||
DCCP_OPEN = TCP_ESTABLISHED,
|
||||
DCCP_REQUESTING = TCP_SYN_SENT,
|
||||
DCCP_LISTEN = TCP_LISTEN,
|
||||
DCCP_RESPOND = TCP_SYN_RECV,
|
||||
/*
|
||||
* States involved in closing a DCCP connection:
|
||||
* 1) ACTIVE_CLOSEREQ is entered by a server sending a CloseReq.
|
||||
*
|
||||
* 2) CLOSING can have three different meanings (RFC 4340, 8.3):
|
||||
* a. Client has performed active-close, has sent a Close to the server
|
||||
* from state OPEN or PARTOPEN, and is waiting for the final Reset
|
||||
* (in this case, SOCK_DONE == 1).
|
||||
* b. Client is asked to perform passive-close, by receiving a CloseReq
|
||||
* in (PART)OPEN state. It sends a Close and waits for final Reset
|
||||
* (in this case, SOCK_DONE == 0).
|
||||
* c. Server performs an active-close as in (a), keeps TIMEWAIT state.
|
||||
*
|
||||
* 3) The following intermediate states are employed to give passively
|
||||
* closing nodes a chance to process their unread data:
|
||||
* - PASSIVE_CLOSE (from OPEN => CLOSED) and
|
||||
* - PASSIVE_CLOSEREQ (from (PART)OPEN to CLOSING; case (b) above).
|
||||
*/
|
||||
DCCP_ACTIVE_CLOSEREQ = TCP_FIN_WAIT1,
|
||||
DCCP_PASSIVE_CLOSE = TCP_CLOSE_WAIT, /* any node receiving a Close */
|
||||
DCCP_CLOSING = TCP_CLOSING,
|
||||
DCCP_TIME_WAIT = TCP_TIME_WAIT,
|
||||
DCCP_CLOSED = TCP_CLOSE,
|
||||
DCCP_PARTOPEN = TCP_MAX_STATES,
|
||||
DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */
|
||||
DCCP_MAX_STATES
|
||||
};
|
||||
|
||||
#define DCCP_STATE_MASK 0xf
|
||||
#define DCCP_ACTION_FIN (1<<7)
|
||||
#define DCCP_STATE_MASK 0x1f
|
||||
|
||||
enum {
|
||||
DCCPF_OPEN = TCPF_ESTABLISHED,
|
||||
DCCPF_REQUESTING = TCPF_SYN_SENT,
|
||||
DCCPF_PARTOPEN = TCPF_FIN_WAIT1,
|
||||
DCCPF_LISTEN = TCPF_LISTEN,
|
||||
DCCPF_RESPOND = TCPF_SYN_RECV,
|
||||
DCCPF_CLOSING = TCPF_CLOSING,
|
||||
DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
|
||||
DCCPF_CLOSED = TCPF_CLOSE,
|
||||
DCCPF_OPEN = TCPF_ESTABLISHED,
|
||||
DCCPF_REQUESTING = TCPF_SYN_SENT,
|
||||
DCCPF_LISTEN = TCPF_LISTEN,
|
||||
DCCPF_RESPOND = TCPF_SYN_RECV,
|
||||
DCCPF_ACTIVE_CLOSEREQ = TCPF_FIN_WAIT1,
|
||||
DCCPF_CLOSING = TCPF_CLOSING,
|
||||
DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
|
||||
DCCPF_CLOSED = TCPF_CLOSE,
|
||||
DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN),
|
||||
};
|
||||
|
||||
static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
|
||||
@@ -393,13 +407,23 @@ struct dccp_opt_pend {
|
||||
|
||||
extern void dccp_minisock_init(struct dccp_minisock *dmsk);
|
||||
|
||||
extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb);
|
||||
|
||||
/**
|
||||
* struct dccp_request_sock - represent DCCP-specific connection request
|
||||
* @dreq_inet_rsk: structure inherited from
|
||||
* @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1)
|
||||
* @dreq_isr: initial sequence number received on the Request
|
||||
* @dreq_service: service code present on the Request (there is just one)
|
||||
* The following two fields are analogous to the ones in dccp_sock:
|
||||
* @dreq_timestamp_echo: last received timestamp to echo (13.1)
|
||||
* @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo
|
||||
*/
|
||||
struct dccp_request_sock {
|
||||
struct inet_request_sock dreq_inet_rsk;
|
||||
__u64 dreq_iss;
|
||||
__u64 dreq_isr;
|
||||
__be32 dreq_service;
|
||||
__u32 dreq_timestamp_echo;
|
||||
__u32 dreq_timestamp_time;
|
||||
};
|
||||
|
||||
static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
|
||||
@@ -409,6 +433,9 @@ static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
|
||||
|
||||
extern struct inet_timewait_death_row dccp_death_row;
|
||||
|
||||
extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
|
||||
struct sk_buff *skb);
|
||||
|
||||
struct dccp_options_received {
|
||||
u32 dccpor_ndp; /* only 24 bits */
|
||||
u32 dccpor_timestamp;
|
||||
@@ -462,8 +489,8 @@ struct dccp_ackvec;
|
||||
* @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
|
||||
* @dccps_service - first (passive sock) or unique (active sock) service code
|
||||
* @dccps_service_list - second .. last service code on passive socket
|
||||
* @dccps_timestamp_time - time of latest TIMESTAMP option
|
||||
* @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
|
||||
* @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo
|
||||
* @dccps_l_ack_ratio - feature-local Ack Ratio
|
||||
* @dccps_r_ack_ratio - feature-remote Ack Ratio
|
||||
* @dccps_pcslen - sender partial checksum coverage (via sockopt)
|
||||
@@ -479,6 +506,7 @@ struct dccp_ackvec;
|
||||
* @dccps_role - role of this sock, one of %dccp_role
|
||||
* @dccps_hc_rx_insert_options - receiver wants to add options when acking
|
||||
* @dccps_hc_tx_insert_options - sender wants to add options when sending
|
||||
* @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3)
|
||||
* @dccps_xmit_timer - timer for when CCID is not ready to send
|
||||
* @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
|
||||
*/
|
||||
@@ -498,8 +526,8 @@ struct dccp_sock {
|
||||
__u64 dccps_gar;
|
||||
__be32 dccps_service;
|
||||
struct dccp_service_list *dccps_service_list;
|
||||
ktime_t dccps_timestamp_time;
|
||||
__u32 dccps_timestamp_echo;
|
||||
__u32 dccps_timestamp_time;
|
||||
__u16 dccps_l_ack_ratio;
|
||||
__u16 dccps_r_ack_ratio;
|
||||
__u16 dccps_pcslen;
|
||||
@@ -515,6 +543,7 @@ struct dccp_sock {
|
||||
enum dccp_role dccps_role:2;
|
||||
__u8 dccps_hc_rx_insert_options:1;
|
||||
__u8 dccps_hc_tx_insert_options:1;
|
||||
__u8 dccps_server_timewait:1;
|
||||
struct timer_list dccps_xmit_timer;
|
||||
};
|
||||
|
||||
|
@@ -47,6 +47,7 @@ struct task_struct;
|
||||
|
||||
#ifdef CONFIG_LOCKDEP
|
||||
extern void debug_show_all_locks(void);
|
||||
extern void __debug_show_held_locks(struct task_struct *task);
|
||||
extern void debug_show_held_locks(struct task_struct *task);
|
||||
extern void debug_check_no_locks_freed(const void *from, unsigned long len);
|
||||
extern void debug_check_no_locks_held(struct task_struct *task);
|
||||
@@ -55,6 +56,10 @@ static inline void debug_show_all_locks(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void __debug_show_held_locks(struct task_struct *task)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void debug_show_held_locks(struct task_struct *task)
|
||||
{
|
||||
}
|
||||
|
@@ -25,75 +25,72 @@
|
||||
#include <asm/device.h>
|
||||
|
||||
#define DEVICE_NAME_SIZE 50
|
||||
#define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */
|
||||
/* DEVICE_NAME_HALF is really less than half to accommodate slop */
|
||||
#define DEVICE_NAME_HALF __stringify(20)
|
||||
#define DEVICE_ID_SIZE 32
|
||||
#define BUS_ID_SIZE KOBJ_NAME_LEN
|
||||
|
||||
|
||||
struct device;
|
||||
struct device_driver;
|
||||
struct driver_private;
|
||||
struct class;
|
||||
struct class_device;
|
||||
struct bus_type;
|
||||
struct bus_type_private;
|
||||
|
||||
struct bus_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct bus_type *, char * buf);
|
||||
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
|
||||
ssize_t (*show)(struct bus_type *bus, char *buf);
|
||||
ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
|
||||
};
|
||||
|
||||
#define BUS_ATTR(_name,_mode,_show,_store) \
|
||||
struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
|
||||
#define BUS_ATTR(_name, _mode, _show, _store) \
|
||||
struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
||||
|
||||
extern int __must_check bus_create_file(struct bus_type *,
|
||||
struct bus_attribute *);
|
||||
extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
|
||||
|
||||
struct bus_type {
|
||||
const char * name;
|
||||
struct module * owner;
|
||||
const char *name;
|
||||
struct bus_attribute *bus_attrs;
|
||||
struct device_attribute *dev_attrs;
|
||||
struct driver_attribute *drv_attrs;
|
||||
|
||||
struct kset subsys;
|
||||
struct kset drivers;
|
||||
struct kset devices;
|
||||
struct klist klist_devices;
|
||||
struct klist klist_drivers;
|
||||
int (*match)(struct device *dev, struct device_driver *drv);
|
||||
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
int (*probe)(struct device *dev);
|
||||
int (*remove)(struct device *dev);
|
||||
void (*shutdown)(struct device *dev);
|
||||
|
||||
struct blocking_notifier_head bus_notifier;
|
||||
int (*suspend)(struct device *dev, pm_message_t state);
|
||||
int (*suspend_late)(struct device *dev, pm_message_t state);
|
||||
int (*resume_early)(struct device *dev);
|
||||
int (*resume)(struct device *dev);
|
||||
|
||||
struct bus_attribute * bus_attrs;
|
||||
struct device_attribute * dev_attrs;
|
||||
struct driver_attribute * drv_attrs;
|
||||
|
||||
int (*match)(struct device * dev, struct device_driver * drv);
|
||||
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
int (*probe)(struct device * dev);
|
||||
int (*remove)(struct device * dev);
|
||||
void (*shutdown)(struct device * dev);
|
||||
|
||||
int (*suspend)(struct device * dev, pm_message_t state);
|
||||
int (*suspend_late)(struct device * dev, pm_message_t state);
|
||||
int (*resume_early)(struct device * dev);
|
||||
int (*resume)(struct device * dev);
|
||||
|
||||
unsigned int drivers_autoprobe:1;
|
||||
struct bus_type_private *p;
|
||||
};
|
||||
|
||||
extern int __must_check bus_register(struct bus_type * bus);
|
||||
extern void bus_unregister(struct bus_type * bus);
|
||||
extern int __must_check bus_register(struct bus_type *bus);
|
||||
extern void bus_unregister(struct bus_type *bus);
|
||||
|
||||
extern int __must_check bus_rescan_devices(struct bus_type * bus);
|
||||
extern int __must_check bus_rescan_devices(struct bus_type *bus);
|
||||
|
||||
/* iterator helpers for buses */
|
||||
|
||||
int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
|
||||
int (*fn)(struct device *, void *));
|
||||
struct device * bus_find_device(struct bus_type *bus, struct device *start,
|
||||
void *data, int (*match)(struct device *, void *));
|
||||
int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
|
||||
int (*fn)(struct device *dev, void *data));
|
||||
struct device *bus_find_device(struct bus_type *bus, struct device *start,
|
||||
void *data,
|
||||
int (*match)(struct device *dev, void *data));
|
||||
struct device *bus_find_device_by_name(struct bus_type *bus,
|
||||
struct device *start,
|
||||
const char *name);
|
||||
|
||||
int __must_check bus_for_each_drv(struct bus_type *bus,
|
||||
struct device_driver *start, void *data,
|
||||
int (*fn)(struct device_driver *, void *));
|
||||
struct device_driver *start, void *data,
|
||||
int (*fn)(struct device_driver *, void *));
|
||||
|
||||
/*
|
||||
* Bus notifiers: Get notified of addition/removal of devices
|
||||
@@ -118,111 +115,128 @@ extern int bus_unregister_notifier(struct bus_type *bus,
|
||||
#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
|
||||
unbound */
|
||||
|
||||
extern struct kset *bus_get_kset(struct bus_type *bus);
|
||||
extern struct klist *bus_get_device_klist(struct bus_type *bus);
|
||||
|
||||
struct device_driver {
|
||||
const char * name;
|
||||
struct bus_type * bus;
|
||||
const char *name;
|
||||
struct bus_type *bus;
|
||||
|
||||
struct kobject kobj;
|
||||
struct klist klist_devices;
|
||||
struct klist_node knode_bus;
|
||||
struct module *owner;
|
||||
const char *mod_name; /* used for built-in modules */
|
||||
|
||||
struct module * owner;
|
||||
const char * mod_name; /* used for built-in modules */
|
||||
struct module_kobject * mkobj;
|
||||
int (*probe) (struct device *dev);
|
||||
int (*remove) (struct device *dev);
|
||||
void (*shutdown) (struct device *dev);
|
||||
int (*suspend) (struct device *dev, pm_message_t state);
|
||||
int (*resume) (struct device *dev);
|
||||
struct attribute_group **groups;
|
||||
|
||||
int (*probe) (struct device * dev);
|
||||
int (*remove) (struct device * dev);
|
||||
void (*shutdown) (struct device * dev);
|
||||
int (*suspend) (struct device * dev, pm_message_t state);
|
||||
int (*resume) (struct device * dev);
|
||||
struct driver_private *p;
|
||||
};
|
||||
|
||||
|
||||
extern int __must_check driver_register(struct device_driver * drv);
|
||||
extern void driver_unregister(struct device_driver * drv);
|
||||
extern int __must_check driver_register(struct device_driver *drv);
|
||||
extern void driver_unregister(struct device_driver *drv);
|
||||
|
||||
extern struct device_driver * get_driver(struct device_driver * drv);
|
||||
extern void put_driver(struct device_driver * drv);
|
||||
extern struct device_driver *driver_find(const char *name, struct bus_type *bus);
|
||||
extern struct device_driver *get_driver(struct device_driver *drv);
|
||||
extern void put_driver(struct device_driver *drv);
|
||||
extern struct device_driver *driver_find(const char *name,
|
||||
struct bus_type *bus);
|
||||
extern int driver_probe_done(void);
|
||||
|
||||
/* sysfs interface for exporting driver attributes */
|
||||
|
||||
struct driver_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct device_driver *, char * buf);
|
||||
ssize_t (*store)(struct device_driver *, const char * buf, size_t count);
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct device_driver *driver, char *buf);
|
||||
ssize_t (*store)(struct device_driver *driver, const char *buf,
|
||||
size_t count);
|
||||
};
|
||||
|
||||
#define DRIVER_ATTR(_name,_mode,_show,_store) \
|
||||
struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store)
|
||||
#define DRIVER_ATTR(_name, _mode, _show, _store) \
|
||||
struct driver_attribute driver_attr_##_name = \
|
||||
__ATTR(_name, _mode, _show, _store)
|
||||
|
||||
extern int __must_check driver_create_file(struct device_driver *,
|
||||
struct driver_attribute *);
|
||||
extern void driver_remove_file(struct device_driver *, struct driver_attribute *);
|
||||
extern int __must_check driver_create_file(struct device_driver *driver,
|
||||
struct driver_attribute *attr);
|
||||
extern void driver_remove_file(struct device_driver *driver,
|
||||
struct driver_attribute *attr);
|
||||
|
||||
extern int __must_check driver_for_each_device(struct device_driver * drv,
|
||||
struct device *start, void *data,
|
||||
int (*fn)(struct device *, void *));
|
||||
struct device * driver_find_device(struct device_driver *drv,
|
||||
struct device *start, void *data,
|
||||
int (*match)(struct device *, void *));
|
||||
extern int __must_check driver_add_kobj(struct device_driver *drv,
|
||||
struct kobject *kobj,
|
||||
const char *fmt, ...);
|
||||
|
||||
extern int __must_check driver_for_each_device(struct device_driver *drv,
|
||||
struct device *start,
|
||||
void *data,
|
||||
int (*fn)(struct device *dev,
|
||||
void *));
|
||||
struct device *driver_find_device(struct device_driver *drv,
|
||||
struct device *start, void *data,
|
||||
int (*match)(struct device *dev, void *data));
|
||||
|
||||
/*
|
||||
* device classes
|
||||
*/
|
||||
struct class {
|
||||
const char * name;
|
||||
struct module * owner;
|
||||
const char *name;
|
||||
struct module *owner;
|
||||
|
||||
struct kset subsys;
|
||||
struct list_head children;
|
||||
struct list_head devices;
|
||||
struct list_head interfaces;
|
||||
struct kset class_dirs;
|
||||
struct semaphore sem; /* locks both the children and interfaces lists */
|
||||
struct semaphore sem; /* locks children, devices, interfaces */
|
||||
struct class_attribute *class_attrs;
|
||||
struct class_device_attribute *class_dev_attrs;
|
||||
struct device_attribute *dev_attrs;
|
||||
|
||||
struct class_attribute * class_attrs;
|
||||
struct class_device_attribute * class_dev_attrs;
|
||||
struct device_attribute * dev_attrs;
|
||||
int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
|
||||
int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
|
||||
int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
|
||||
int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
void (*release)(struct class_device *dev);
|
||||
void (*class_release)(struct class *class);
|
||||
void (*dev_release)(struct device *dev);
|
||||
|
||||
void (*release)(struct class_device *dev);
|
||||
void (*class_release)(struct class *class);
|
||||
void (*dev_release)(struct device *dev);
|
||||
|
||||
int (*suspend)(struct device *, pm_message_t state);
|
||||
int (*resume)(struct device *);
|
||||
int (*suspend)(struct device *dev, pm_message_t state);
|
||||
int (*resume)(struct device *dev);
|
||||
};
|
||||
|
||||
extern int __must_check class_register(struct class *);
|
||||
extern void class_unregister(struct class *);
|
||||
extern int __must_check class_register(struct class *class);
|
||||
extern void class_unregister(struct class *class);
|
||||
extern int class_for_each_device(struct class *class, void *data,
|
||||
int (*fn)(struct device *dev, void *data));
|
||||
extern struct device *class_find_device(struct class *class, void *data,
|
||||
int (*match)(struct device *, void *));
|
||||
extern struct class_device *class_find_child(struct class *class, void *data,
|
||||
int (*match)(struct class_device *, void *));
|
||||
|
||||
|
||||
struct class_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct class *, char * buf);
|
||||
ssize_t (*store)(struct class *, const char * buf, size_t count);
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct class *class, char *buf);
|
||||
ssize_t (*store)(struct class *class, const char *buf, size_t count);
|
||||
};
|
||||
|
||||
#define CLASS_ATTR(_name,_mode,_show,_store) \
|
||||
struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store)
|
||||
#define CLASS_ATTR(_name, _mode, _show, _store) \
|
||||
struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
||||
|
||||
extern int __must_check class_create_file(struct class *,
|
||||
const struct class_attribute *);
|
||||
extern void class_remove_file(struct class *, const struct class_attribute *);
|
||||
extern int __must_check class_create_file(struct class *class,
|
||||
const struct class_attribute *attr);
|
||||
extern void class_remove_file(struct class *class,
|
||||
const struct class_attribute *attr);
|
||||
|
||||
struct class_device_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct class_device *, char * buf);
|
||||
ssize_t (*store)(struct class_device *, const char * buf, size_t count);
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct class_device *, char *buf);
|
||||
ssize_t (*store)(struct class_device *, const char *buf, size_t count);
|
||||
};
|
||||
|
||||
#define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \
|
||||
#define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \
|
||||
struct class_device_attribute class_device_attr_##_name = \
|
||||
__ATTR(_name,_mode,_show,_store)
|
||||
__ATTR(_name, _mode, _show, _store)
|
||||
|
||||
extern int __must_check class_device_create_file(struct class_device *,
|
||||
const struct class_device_attribute *);
|
||||
@@ -255,26 +269,24 @@ struct class_device {
|
||||
struct list_head node;
|
||||
|
||||
struct kobject kobj;
|
||||
struct class * class; /* required */
|
||||
dev_t devt; /* dev_t, creates the sysfs "dev" */
|
||||
struct device * dev; /* not necessary, but nice to have */
|
||||
void * class_data; /* class-specific data */
|
||||
struct class_device *parent; /* parent of this child device, if there is one */
|
||||
struct attribute_group ** groups; /* optional groups */
|
||||
struct class *class;
|
||||
dev_t devt;
|
||||
struct device *dev;
|
||||
void *class_data;
|
||||
struct class_device *parent;
|
||||
struct attribute_group **groups;
|
||||
|
||||
void (*release)(struct class_device *dev);
|
||||
int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
|
||||
char class_id[BUS_ID_SIZE]; /* unique to this class */
|
||||
void (*release)(struct class_device *dev);
|
||||
int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
|
||||
char class_id[BUS_ID_SIZE];
|
||||
};
|
||||
|
||||
static inline void *
|
||||
class_get_devdata (struct class_device *dev)
|
||||
static inline void *class_get_devdata(struct class_device *dev)
|
||||
{
|
||||
return dev->class_data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
class_set_devdata (struct class_device *dev, void *data)
|
||||
static inline void class_set_devdata(struct class_device *dev, void *data)
|
||||
{
|
||||
dev->class_data = data;
|
||||
}
|
||||
@@ -286,10 +298,10 @@ extern void class_device_initialize(struct class_device *);
|
||||
extern int __must_check class_device_add(struct class_device *);
|
||||
extern void class_device_del(struct class_device *);
|
||||
|
||||
extern struct class_device * class_device_get(struct class_device *);
|
||||
extern struct class_device *class_device_get(struct class_device *);
|
||||
extern void class_device_put(struct class_device *);
|
||||
|
||||
extern void class_device_remove_file(struct class_device *,
|
||||
extern void class_device_remove_file(struct class_device *,
|
||||
const struct class_device_attribute *);
|
||||
extern int __must_check class_device_create_bin_file(struct class_device *,
|
||||
struct bin_attribute *);
|
||||
@@ -316,7 +328,7 @@ extern struct class_device *class_device_create(struct class *cls,
|
||||
dev_t devt,
|
||||
struct device *device,
|
||||
const char *fmt, ...)
|
||||
__attribute__((format(printf,5,6)));
|
||||
__attribute__((format(printf, 5, 6)));
|
||||
extern void class_device_destroy(struct class *cls, dev_t devt);
|
||||
|
||||
/*
|
||||
@@ -333,8 +345,8 @@ struct device_type {
|
||||
struct attribute_group **groups;
|
||||
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
void (*release)(struct device *dev);
|
||||
int (*suspend)(struct device * dev, pm_message_t state);
|
||||
int (*resume)(struct device * dev);
|
||||
int (*suspend)(struct device *dev, pm_message_t state);
|
||||
int (*resume)(struct device *dev);
|
||||
};
|
||||
|
||||
/* interface for exporting device attributes */
|
||||
@@ -346,18 +358,19 @@ struct device_attribute {
|
||||
const char *buf, size_t count);
|
||||
};
|
||||
|
||||
#define DEVICE_ATTR(_name,_mode,_show,_store) \
|
||||
struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
|
||||
#define DEVICE_ATTR(_name, _mode, _show, _store) \
|
||||
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
||||
|
||||
extern int __must_check device_create_file(struct device *device,
|
||||
struct device_attribute * entry);
|
||||
extern void device_remove_file(struct device * dev, struct device_attribute * attr);
|
||||
struct device_attribute *entry);
|
||||
extern void device_remove_file(struct device *dev,
|
||||
struct device_attribute *attr);
|
||||
extern int __must_check device_create_bin_file(struct device *dev,
|
||||
struct bin_attribute *attr);
|
||||
extern void device_remove_bin_file(struct device *dev,
|
||||
struct bin_attribute *attr);
|
||||
extern int device_schedule_callback_owner(struct device *dev,
|
||||
void (*func)(struct device *), struct module *owner);
|
||||
void (*func)(struct device *dev), struct module *owner);
|
||||
|
||||
/* This is a macro to avoid include problems with THIS_MODULE */
|
||||
#define device_schedule_callback(dev, func) \
|
||||
@@ -368,21 +381,21 @@ typedef void (*dr_release_t)(struct device *dev, void *res);
|
||||
typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
|
||||
|
||||
#ifdef CONFIG_DEBUG_DEVRES
|
||||
extern void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
|
||||
extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
|
||||
const char *name);
|
||||
#define devres_alloc(release, size, gfp) \
|
||||
__devres_alloc(release, size, gfp, #release)
|
||||
#else
|
||||
extern void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
|
||||
extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
|
||||
#endif
|
||||
extern void devres_free(void *res);
|
||||
extern void devres_add(struct device *dev, void *res);
|
||||
extern void * devres_find(struct device *dev, dr_release_t release,
|
||||
dr_match_t match, void *match_data);
|
||||
extern void * devres_get(struct device *dev, void *new_res,
|
||||
extern void *devres_find(struct device *dev, dr_release_t release,
|
||||
dr_match_t match, void *match_data);
|
||||
extern void * devres_remove(struct device *dev, dr_release_t release,
|
||||
dr_match_t match, void *match_data);
|
||||
extern void *devres_get(struct device *dev, void *new_res,
|
||||
dr_match_t match, void *match_data);
|
||||
extern void *devres_remove(struct device *dev, dr_release_t release,
|
||||
dr_match_t match, void *match_data);
|
||||
extern int devres_destroy(struct device *dev, dr_release_t release,
|
||||
dr_match_t match, void *match_data);
|
||||
|
||||
@@ -399,7 +412,7 @@ extern void devm_kfree(struct device *dev, void *p);
|
||||
|
||||
struct device {
|
||||
struct klist klist_children;
|
||||
struct klist_node knode_parent; /* node in sibling list */
|
||||
struct klist_node knode_parent; /* node in sibling list */
|
||||
struct klist_node knode_driver;
|
||||
struct klist_node knode_bus;
|
||||
struct device *parent;
|
||||
@@ -414,7 +427,7 @@ struct device {
|
||||
* its driver.
|
||||
*/
|
||||
|
||||
struct bus_type * bus; /* type of bus device is on */
|
||||
struct bus_type *bus; /* type of bus device is on */
|
||||
struct device_driver *driver; /* which driver has allocated this
|
||||
device */
|
||||
void *driver_data; /* data private to the driver */
|
||||
@@ -445,10 +458,10 @@ struct device {
|
||||
/* class_device migration path */
|
||||
struct list_head node;
|
||||
struct class *class;
|
||||
dev_t devt; /* dev_t, creates the sysfs "dev" */
|
||||
dev_t devt; /* dev_t, creates the sysfs "dev" */
|
||||
struct attribute_group **groups; /* optional groups */
|
||||
|
||||
void (*release)(struct device * dev);
|
||||
void (*release)(struct device *dev);
|
||||
};
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
@@ -470,14 +483,12 @@ static inline void set_dev_node(struct device *dev, int node)
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void *
|
||||
dev_get_drvdata (struct device *dev)
|
||||
static inline void *dev_get_drvdata(struct device *dev)
|
||||
{
|
||||
return dev->driver_data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
dev_set_drvdata (struct device *dev, void *data)
|
||||
static inline void dev_set_drvdata(struct device *dev, void *data)
|
||||
{
|
||||
dev->driver_data = data;
|
||||
}
|
||||
@@ -492,15 +503,15 @@ void driver_init(void);
|
||||
/*
|
||||
* High level routines for use by the bus drivers
|
||||
*/
|
||||
extern int __must_check device_register(struct device * dev);
|
||||
extern void device_unregister(struct device * dev);
|
||||
extern void device_initialize(struct device * dev);
|
||||
extern int __must_check device_add(struct device * dev);
|
||||
extern void device_del(struct device * dev);
|
||||
extern int device_for_each_child(struct device *, void *,
|
||||
int (*fn)(struct device *, void *));
|
||||
extern struct device *device_find_child(struct device *, void *data,
|
||||
int (*match)(struct device *, void *));
|
||||
extern int __must_check device_register(struct device *dev);
|
||||
extern void device_unregister(struct device *dev);
|
||||
extern void device_initialize(struct device *dev);
|
||||
extern int __must_check device_add(struct device *dev);
|
||||
extern void device_del(struct device *dev);
|
||||
extern int device_for_each_child(struct device *dev, void *data,
|
||||
int (*fn)(struct device *dev, void *data));
|
||||
extern struct device *device_find_child(struct device *dev, void *data,
|
||||
int (*match)(struct device *dev, void *data));
|
||||
extern int device_rename(struct device *dev, char *new_name);
|
||||
extern int device_move(struct device *dev, struct device *new_parent);
|
||||
|
||||
@@ -509,8 +520,8 @@ extern int device_move(struct device *dev, struct device *new_parent);
|
||||
* for information on use.
|
||||
*/
|
||||
extern int __must_check device_bind_driver(struct device *dev);
|
||||
extern void device_release_driver(struct device * dev);
|
||||
extern int __must_check device_attach(struct device * dev);
|
||||
extern void device_release_driver(struct device *dev);
|
||||
extern int __must_check device_attach(struct device *dev);
|
||||
extern int __must_check driver_attach(struct device_driver *drv);
|
||||
extern int __must_check device_reprobe(struct device *dev);
|
||||
|
||||
@@ -519,8 +530,16 @@ extern int __must_check device_reprobe(struct device *dev);
|
||||
*/
|
||||
extern struct device *device_create(struct class *cls, struct device *parent,
|
||||
dev_t devt, const char *fmt, ...)
|
||||
__attribute__((format(printf,4,5)));
|
||||
__attribute__((format(printf, 4, 5)));
|
||||
extern void device_destroy(struct class *cls, dev_t devt);
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
extern void destroy_suspended_device(struct class *cls, dev_t devt);
|
||||
#else /* !CONFIG_PM_SLEEP */
|
||||
static inline void destroy_suspended_device(struct class *cls, dev_t devt)
|
||||
{
|
||||
device_destroy(cls, devt);
|
||||
}
|
||||
#endif /* !CONFIG_PM_SLEEP */
|
||||
|
||||
/*
|
||||
* Platform "fixup" functions - allow the platform to have their say
|
||||
@@ -528,17 +547,17 @@ extern void device_destroy(struct class *cls, dev_t devt);
|
||||
* know about.
|
||||
*/
|
||||
/* Notify platform of device discovery */
|
||||
extern int (*platform_notify)(struct device * dev);
|
||||
extern int (*platform_notify)(struct device *dev);
|
||||
|
||||
extern int (*platform_notify_remove)(struct device * dev);
|
||||
extern int (*platform_notify_remove)(struct device *dev);
|
||||
|
||||
|
||||
/**
|
||||
* get_device - atomically increment the reference count for the device.
|
||||
*
|
||||
*/
|
||||
extern struct device * get_device(struct device * dev);
|
||||
extern void put_device(struct device * dev);
|
||||
extern struct device *get_device(struct device *dev);
|
||||
extern void put_device(struct device *dev);
|
||||
|
||||
|
||||
/* drivers/base/power/shutdown.c */
|
||||
@@ -547,22 +566,33 @@ extern void device_shutdown(void);
|
||||
/* drivers/base/sys.c */
|
||||
extern void sysdev_shutdown(void);
|
||||
|
||||
|
||||
/* drivers/base/firmware.c */
|
||||
extern int __must_check firmware_register(struct kset *);
|
||||
extern void firmware_unregister(struct kset *);
|
||||
|
||||
/* debugging and troubleshooting/diagnostic helpers. */
|
||||
extern const char *dev_driver_string(struct device *dev);
|
||||
#define dev_printk(level, dev, format, arg...) \
|
||||
printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg)
|
||||
printk(level "%s %s: " format , dev_driver_string(dev) , \
|
||||
(dev)->bus_id , ## arg)
|
||||
|
||||
#define dev_emerg(dev, format, arg...) \
|
||||
dev_printk(KERN_EMERG , dev , format , ## arg)
|
||||
#define dev_alert(dev, format, arg...) \
|
||||
dev_printk(KERN_ALERT , dev , format , ## arg)
|
||||
#define dev_crit(dev, format, arg...) \
|
||||
dev_printk(KERN_CRIT , dev , format , ## arg)
|
||||
#define dev_err(dev, format, arg...) \
|
||||
dev_printk(KERN_ERR , dev , format , ## arg)
|
||||
#define dev_warn(dev, format, arg...) \
|
||||
dev_printk(KERN_WARNING , dev , format , ## arg)
|
||||
#define dev_notice(dev, format, arg...) \
|
||||
dev_printk(KERN_NOTICE , dev , format , ## arg)
|
||||
#define dev_info(dev, format, arg...) \
|
||||
dev_printk(KERN_INFO , dev , format , ## arg)
|
||||
|
||||
#ifdef DEBUG
|
||||
#define dev_dbg(dev, format, arg...) \
|
||||
dev_printk(KERN_DEBUG , dev , format , ## arg)
|
||||
#else
|
||||
static inline int __attribute__ ((format (printf, 2, 3)))
|
||||
dev_dbg(struct device * dev, const char * fmt, ...)
|
||||
dev_dbg(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -572,21 +602,12 @@ dev_dbg(struct device * dev, const char * fmt, ...)
|
||||
#define dev_vdbg dev_dbg
|
||||
#else
|
||||
static inline int __attribute__ ((format (printf, 2, 3)))
|
||||
dev_vdbg(struct device * dev, const char * fmt, ...)
|
||||
dev_vdbg(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define dev_err(dev, format, arg...) \
|
||||
dev_printk(KERN_ERR , dev , format , ## arg)
|
||||
#define dev_info(dev, format, arg...) \
|
||||
dev_printk(KERN_INFO , dev , format , ## arg)
|
||||
#define dev_warn(dev, format, arg...) \
|
||||
dev_printk(KERN_WARNING , dev , format , ## arg)
|
||||
#define dev_notice(dev, format, arg...) \
|
||||
dev_printk(KERN_NOTICE , dev , format , ## arg)
|
||||
|
||||
/* Create alias, so I can be autoloaded. */
|
||||
#define MODULE_ALIAS_CHARDEV(major,minor) \
|
||||
MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
|
||||
|
@@ -19,148 +19,12 @@
|
||||
* routines and structures to use DLM lockspaces
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lock Modes
|
||||
*/
|
||||
/* Lock levels and flags are here */
|
||||
#include <linux/dlmconstants.h>
|
||||
|
||||
#define DLM_LOCK_IV -1 /* invalid */
|
||||
#define DLM_LOCK_NL 0 /* null */
|
||||
#define DLM_LOCK_CR 1 /* concurrent read */
|
||||
#define DLM_LOCK_CW 2 /* concurrent write */
|
||||
#define DLM_LOCK_PR 3 /* protected read */
|
||||
#define DLM_LOCK_PW 4 /* protected write */
|
||||
#define DLM_LOCK_EX 5 /* exclusive */
|
||||
|
||||
/*
|
||||
* Maximum size in bytes of a dlm_lock name
|
||||
*/
|
||||
|
||||
#define DLM_RESNAME_MAXLEN 64
|
||||
|
||||
/*
|
||||
* Flags to dlm_lock
|
||||
*
|
||||
* DLM_LKF_NOQUEUE
|
||||
*
|
||||
* Do not queue the lock request on the wait queue if it cannot be granted
|
||||
* immediately. If the lock cannot be granted because of this flag, DLM will
|
||||
* either return -EAGAIN from the dlm_lock call or will return 0 from
|
||||
* dlm_lock and -EAGAIN in the lock status block when the AST is executed.
|
||||
*
|
||||
* DLM_LKF_CANCEL
|
||||
*
|
||||
* Used to cancel a pending lock request or conversion. A converting lock is
|
||||
* returned to its previously granted mode.
|
||||
*
|
||||
* DLM_LKF_CONVERT
|
||||
*
|
||||
* Indicates a lock conversion request. For conversions the name and namelen
|
||||
* are ignored and the lock ID in the LKSB is used to identify the lock.
|
||||
*
|
||||
* DLM_LKF_VALBLK
|
||||
*
|
||||
* Requests DLM to return the current contents of the lock value block in the
|
||||
* lock status block. When this flag is set in a lock conversion from PW or EX
|
||||
* modes, DLM assigns the value specified in the lock status block to the lock
|
||||
* value block of the lock resource. The LVB is a DLM_LVB_LEN size array
|
||||
* containing application-specific information.
|
||||
*
|
||||
* DLM_LKF_QUECVT
|
||||
*
|
||||
* Force a conversion request to be queued, even if it is compatible with
|
||||
* the granted modes of other locks on the same resource.
|
||||
*
|
||||
* DLM_LKF_IVVALBLK
|
||||
*
|
||||
* Invalidate the lock value block.
|
||||
*
|
||||
* DLM_LKF_CONVDEADLK
|
||||
*
|
||||
* Allows the dlm to resolve conversion deadlocks internally by demoting the
|
||||
* granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
|
||||
* returned for a conversion that's been effected by this.
|
||||
*
|
||||
* DLM_LKF_PERSISTENT
|
||||
*
|
||||
* Only relevant to locks originating in userspace. A persistent lock will not
|
||||
* be removed if the process holding the lock exits.
|
||||
*
|
||||
* DLM_LKF_NODLCKWT
|
||||
*
|
||||
* Do not cancel the lock if it gets into conversion deadlock.
|
||||
* Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
|
||||
*
|
||||
* DLM_LKF_NODLCKBLK
|
||||
*
|
||||
* net yet implemented
|
||||
*
|
||||
* DLM_LKF_EXPEDITE
|
||||
*
|
||||
* Used only with new requests for NL mode locks. Tells the lock manager
|
||||
* to grant the lock, ignoring other locks in convert and wait queues.
|
||||
*
|
||||
* DLM_LKF_NOQUEUEBAST
|
||||
*
|
||||
* Send blocking AST's before returning -EAGAIN to the caller. It is only
|
||||
* used along with the NOQUEUE flag. Blocking AST's are not sent for failed
|
||||
* NOQUEUE requests otherwise.
|
||||
*
|
||||
* DLM_LKF_HEADQUE
|
||||
*
|
||||
* Add a lock to the head of the convert or wait queue rather than the tail.
|
||||
*
|
||||
* DLM_LKF_NOORDER
|
||||
*
|
||||
* Disregard the standard grant order rules and grant a lock as soon as it
|
||||
* is compatible with other granted locks.
|
||||
*
|
||||
* DLM_LKF_ORPHAN
|
||||
*
|
||||
* not yet implemented
|
||||
*
|
||||
* DLM_LKF_ALTPR
|
||||
*
|
||||
* If the requested mode cannot be granted immediately, try to grant the lock
|
||||
* in PR mode instead. If this alternate mode is granted instead of the
|
||||
* requested mode, DLM_SBF_ALTMODE is returned in the lksb.
|
||||
*
|
||||
* DLM_LKF_ALTCW
|
||||
*
|
||||
* The same as ALTPR, but the alternate mode is CW.
|
||||
*
|
||||
* DLM_LKF_FORCEUNLOCK
|
||||
*
|
||||
* Unlock the lock even if it is converting or waiting or has sublocks.
|
||||
* Only really for use by the userland device.c code.
|
||||
*
|
||||
*/
|
||||
|
||||
#define DLM_LKF_NOQUEUE 0x00000001
|
||||
#define DLM_LKF_CANCEL 0x00000002
|
||||
#define DLM_LKF_CONVERT 0x00000004
|
||||
#define DLM_LKF_VALBLK 0x00000008
|
||||
#define DLM_LKF_QUECVT 0x00000010
|
||||
#define DLM_LKF_IVVALBLK 0x00000020
|
||||
#define DLM_LKF_CONVDEADLK 0x00000040
|
||||
#define DLM_LKF_PERSISTENT 0x00000080
|
||||
#define DLM_LKF_NODLCKWT 0x00000100
|
||||
#define DLM_LKF_NODLCKBLK 0x00000200
|
||||
#define DLM_LKF_EXPEDITE 0x00000400
|
||||
#define DLM_LKF_NOQUEUEBAST 0x00000800
|
||||
#define DLM_LKF_HEADQUE 0x00001000
|
||||
#define DLM_LKF_NOORDER 0x00002000
|
||||
#define DLM_LKF_ORPHAN 0x00004000
|
||||
#define DLM_LKF_ALTPR 0x00008000
|
||||
#define DLM_LKF_ALTCW 0x00010000
|
||||
#define DLM_LKF_FORCEUNLOCK 0x00020000
|
||||
#define DLM_LKF_TIMEOUT 0x00040000
|
||||
|
||||
/*
|
||||
* Some return codes that are not in errno.h
|
||||
*/
|
||||
|
||||
#define DLM_ECANCEL 0x10001
|
||||
#define DLM_EUNLOCK 0x10002
|
||||
|
||||
typedef void dlm_lockspace_t;
|
||||
|
||||
|
159
include/linux/dlmconstants.h
Normal file
159
include/linux/dlmconstants.h
Normal file
@@ -0,0 +1,159 @@
|
||||
/******************************************************************************
|
||||
*******************************************************************************
|
||||
**
|
||||
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
|
||||
** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
|
||||
**
|
||||
** This copyrighted material is made available to anyone wishing to use,
|
||||
** modify, copy, or redistribute it subject to the terms and conditions
|
||||
** of the GNU General Public License v.2.
|
||||
**
|
||||
*******************************************************************************
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __DLMCONSTANTS_DOT_H__
|
||||
#define __DLMCONSTANTS_DOT_H__
|
||||
|
||||
/*
|
||||
* Constants used by DLM interface.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lock Modes
|
||||
*/
|
||||
|
||||
#define DLM_LOCK_IV (-1) /* invalid */
|
||||
#define DLM_LOCK_NL 0 /* null */
|
||||
#define DLM_LOCK_CR 1 /* concurrent read */
|
||||
#define DLM_LOCK_CW 2 /* concurrent write */
|
||||
#define DLM_LOCK_PR 3 /* protected read */
|
||||
#define DLM_LOCK_PW 4 /* protected write */
|
||||
#define DLM_LOCK_EX 5 /* exclusive */
|
||||
|
||||
|
||||
/*
|
||||
* Flags to dlm_lock
|
||||
*
|
||||
* DLM_LKF_NOQUEUE
|
||||
*
|
||||
* Do not queue the lock request on the wait queue if it cannot be granted
|
||||
* immediately. If the lock cannot be granted because of this flag, DLM will
|
||||
* either return -EAGAIN from the dlm_lock call or will return 0 from
|
||||
* dlm_lock and -EAGAIN in the lock status block when the AST is executed.
|
||||
*
|
||||
* DLM_LKF_CANCEL
|
||||
*
|
||||
* Used to cancel a pending lock request or conversion. A converting lock is
|
||||
* returned to its previously granted mode.
|
||||
*
|
||||
* DLM_LKF_CONVERT
|
||||
*
|
||||
* Indicates a lock conversion request. For conversions the name and namelen
|
||||
* are ignored and the lock ID in the LKSB is used to identify the lock.
|
||||
*
|
||||
* DLM_LKF_VALBLK
|
||||
*
|
||||
* Requests DLM to return the current contents of the lock value block in the
|
||||
* lock status block. When this flag is set in a lock conversion from PW or EX
|
||||
* modes, DLM assigns the value specified in the lock status block to the lock
|
||||
* value block of the lock resource. The LVB is a DLM_LVB_LEN size array
|
||||
* containing application-specific information.
|
||||
*
|
||||
* DLM_LKF_QUECVT
|
||||
*
|
||||
* Force a conversion request to be queued, even if it is compatible with
|
||||
* the granted modes of other locks on the same resource.
|
||||
*
|
||||
* DLM_LKF_IVVALBLK
|
||||
*
|
||||
* Invalidate the lock value block.
|
||||
*
|
||||
* DLM_LKF_CONVDEADLK
|
||||
*
|
||||
* Allows the dlm to resolve conversion deadlocks internally by demoting the
|
||||
* granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
|
||||
* returned for a conversion that's been effected by this.
|
||||
*
|
||||
* DLM_LKF_PERSISTENT
|
||||
*
|
||||
* Only relevant to locks originating in userspace. A persistent lock will not
|
||||
* be removed if the process holding the lock exits.
|
||||
*
|
||||
* DLM_LKF_NODLCKWT
|
||||
*
|
||||
* Do not cancel the lock if it gets into conversion deadlock.
|
||||
* Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
|
||||
*
|
||||
* DLM_LKF_NODLCKBLK
|
||||
*
|
||||
* net yet implemented
|
||||
*
|
||||
* DLM_LKF_EXPEDITE
|
||||
*
|
||||
* Used only with new requests for NL mode locks. Tells the lock manager
|
||||
* to grant the lock, ignoring other locks in convert and wait queues.
|
||||
*
|
||||
* DLM_LKF_NOQUEUEBAST
|
||||
*
|
||||
* Send blocking AST's before returning -EAGAIN to the caller. It is only
|
||||
* used along with the NOQUEUE flag. Blocking AST's are not sent for failed
|
||||
* NOQUEUE requests otherwise.
|
||||
*
|
||||
* DLM_LKF_HEADQUE
|
||||
*
|
||||
* Add a lock to the head of the convert or wait queue rather than the tail.
|
||||
*
|
||||
* DLM_LKF_NOORDER
|
||||
*
|
||||
* Disregard the standard grant order rules and grant a lock as soon as it
|
||||
* is compatible with other granted locks.
|
||||
*
|
||||
* DLM_LKF_ORPHAN
|
||||
*
|
||||
* not yet implemented
|
||||
*
|
||||
* DLM_LKF_ALTPR
|
||||
*
|
||||
* If the requested mode cannot be granted immediately, try to grant the lock
|
||||
* in PR mode instead. If this alternate mode is granted instead of the
|
||||
* requested mode, DLM_SBF_ALTMODE is returned in the lksb.
|
||||
*
|
||||
* DLM_LKF_ALTCW
|
||||
*
|
||||
* The same as ALTPR, but the alternate mode is CW.
|
||||
*
|
||||
* DLM_LKF_FORCEUNLOCK
|
||||
*
|
||||
* Unlock the lock even if it is converting or waiting or has sublocks.
|
||||
* Only really for use by the userland device.c code.
|
||||
*
|
||||
*/
|
||||
|
||||
#define DLM_LKF_NOQUEUE 0x00000001
|
||||
#define DLM_LKF_CANCEL 0x00000002
|
||||
#define DLM_LKF_CONVERT 0x00000004
|
||||
#define DLM_LKF_VALBLK 0x00000008
|
||||
#define DLM_LKF_QUECVT 0x00000010
|
||||
#define DLM_LKF_IVVALBLK 0x00000020
|
||||
#define DLM_LKF_CONVDEADLK 0x00000040
|
||||
#define DLM_LKF_PERSISTENT 0x00000080
|
||||
#define DLM_LKF_NODLCKWT 0x00000100
|
||||
#define DLM_LKF_NODLCKBLK 0x00000200
|
||||
#define DLM_LKF_EXPEDITE 0x00000400
|
||||
#define DLM_LKF_NOQUEUEBAST 0x00000800
|
||||
#define DLM_LKF_HEADQUE 0x00001000
|
||||
#define DLM_LKF_NOORDER 0x00002000
|
||||
#define DLM_LKF_ORPHAN 0x00004000
|
||||
#define DLM_LKF_ALTPR 0x00008000
|
||||
#define DLM_LKF_ALTCW 0x00010000
|
||||
#define DLM_LKF_FORCEUNLOCK 0x00020000
|
||||
#define DLM_LKF_TIMEOUT 0x00040000
|
||||
|
||||
/*
|
||||
* Some return codes that are not in errno.h
|
||||
*/
|
||||
|
||||
#define DLM_ECANCEL 0x10001
|
||||
#define DLM_EUNLOCK 0x10002
|
||||
|
||||
#endif /* __DLMCONSTANTS_DOT_H__ */
|
@@ -132,7 +132,7 @@ struct dma_chan {
|
||||
|
||||
/* sysfs */
|
||||
int chan_id;
|
||||
struct class_device class_dev;
|
||||
struct device dev;
|
||||
|
||||
struct kref refcount;
|
||||
int slow_ref;
|
||||
@@ -142,6 +142,7 @@ struct dma_chan {
|
||||
struct dma_chan_percpu *local;
|
||||
};
|
||||
|
||||
#define to_dma_chan(p) container_of(p, struct dma_chan, dev)
|
||||
|
||||
void dma_chan_cleanup(struct kref *kref);
|
||||
|
||||
|
@@ -78,6 +78,8 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name,
|
||||
extern void dmi_scan_machine(void);
|
||||
extern int dmi_get_year(int field);
|
||||
extern int dmi_name_in_vendors(const char *str);
|
||||
extern int dmi_available;
|
||||
extern char *dmi_get_slot(int slot);
|
||||
|
||||
#else
|
||||
|
||||
@@ -87,6 +89,8 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
|
||||
const struct dmi_device *from) { return NULL; }
|
||||
static inline int dmi_get_year(int year) { return 0; }
|
||||
static inline int dmi_name_in_vendors(const char *s) { return 0; }
|
||||
#define dmi_available 0
|
||||
static inline char *dmi_get_slot(int slot) { return NULL; }
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -355,6 +355,7 @@ typedef struct elf64_shdr {
|
||||
#define NT_AUXV 6
|
||||
#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
|
||||
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
|
||||
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
|
||||
|
||||
|
||||
/* Note header in a PT_NOTE section */
|
||||
|
@@ -76,7 +76,7 @@
|
||||
typeof(desc) _desc \
|
||||
__attribute__((aligned(sizeof(Elf##size##_Word)))); \
|
||||
} _ELFNOTE_PASTE(_note_, unique) \
|
||||
__attribute_used__ \
|
||||
__used \
|
||||
__attribute__((section(".note." name), \
|
||||
aligned(sizeof(Elf##size##_Word)), \
|
||||
unused)) = { \
|
||||
|
@@ -20,6 +20,8 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/magic.h>
|
||||
|
||||
#include <linux/ext4_fs_i.h>
|
||||
|
||||
/*
|
||||
* The second extended filesystem constants/structures
|
||||
*/
|
||||
@@ -51,6 +53,50 @@
|
||||
#define ext4_debug(f, a...) do {} while (0)
|
||||
#endif
|
||||
|
||||
#define EXT4_MULTIBLOCK_ALLOCATOR 1
|
||||
|
||||
/* prefer goal again. length */
|
||||
#define EXT4_MB_HINT_MERGE 1
|
||||
/* blocks already reserved */
|
||||
#define EXT4_MB_HINT_RESERVED 2
|
||||
/* metadata is being allocated */
|
||||
#define EXT4_MB_HINT_METADATA 4
|
||||
/* first blocks in the file */
|
||||
#define EXT4_MB_HINT_FIRST 8
|
||||
/* search for the best chunk */
|
||||
#define EXT4_MB_HINT_BEST 16
|
||||
/* data is being allocated */
|
||||
#define EXT4_MB_HINT_DATA 32
|
||||
/* don't preallocate (for tails) */
|
||||
#define EXT4_MB_HINT_NOPREALLOC 64
|
||||
/* allocate for locality group */
|
||||
#define EXT4_MB_HINT_GROUP_ALLOC 128
|
||||
/* allocate goal blocks or none */
|
||||
#define EXT4_MB_HINT_GOAL_ONLY 256
|
||||
/* goal is meaningful */
|
||||
#define EXT4_MB_HINT_TRY_GOAL 512
|
||||
|
||||
struct ext4_allocation_request {
|
||||
/* target inode for block we're allocating */
|
||||
struct inode *inode;
|
||||
/* logical block in target inode */
|
||||
ext4_lblk_t logical;
|
||||
/* phys. target (a hint) */
|
||||
ext4_fsblk_t goal;
|
||||
/* the closest logical allocated block to the left */
|
||||
ext4_lblk_t lleft;
|
||||
/* phys. block for ^^^ */
|
||||
ext4_fsblk_t pleft;
|
||||
/* the closest logical allocated block to the right */
|
||||
ext4_lblk_t lright;
|
||||
/* phys. block for ^^^ */
|
||||
ext4_fsblk_t pright;
|
||||
/* how many blocks we want to allocate */
|
||||
unsigned long len;
|
||||
/* flags. see above EXT4_MB_HINT_* */
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* Special inodes numbers
|
||||
*/
|
||||
@@ -73,8 +119,8 @@
|
||||
* Macro-instructions used to manage several block sizes
|
||||
*/
|
||||
#define EXT4_MIN_BLOCK_SIZE 1024
|
||||
#define EXT4_MAX_BLOCK_SIZE 4096
|
||||
#define EXT4_MIN_BLOCK_LOG_SIZE 10
|
||||
#define EXT4_MAX_BLOCK_SIZE 65536
|
||||
#define EXT4_MIN_BLOCK_LOG_SIZE 10
|
||||
#ifdef __KERNEL__
|
||||
# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize)
|
||||
#else
|
||||
@@ -118,6 +164,11 @@ struct ext4_group_desc
|
||||
__le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
|
||||
__le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
|
||||
__le32 bg_inode_table_hi; /* Inodes table block MSB */
|
||||
__le16 bg_free_blocks_count_hi;/* Free blocks count MSB */
|
||||
__le16 bg_free_inodes_count_hi;/* Free inodes count MSB */
|
||||
__le16 bg_used_dirs_count_hi; /* Directories count MSB */
|
||||
__le16 bg_itable_unused_hi; /* Unused inodes count MSB */
|
||||
__u32 bg_reserved2[3];
|
||||
};
|
||||
|
||||
#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
|
||||
@@ -178,8 +229,9 @@ struct ext4_group_desc
|
||||
#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */
|
||||
#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
|
||||
#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
|
||||
#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
|
||||
#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
|
||||
#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
|
||||
#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
|
||||
|
||||
#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
|
||||
#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
|
||||
@@ -237,6 +289,7 @@ struct ext4_new_group_data {
|
||||
#endif
|
||||
#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
|
||||
#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long)
|
||||
#define EXT4_IOC_MIGRATE _IO('f', 7)
|
||||
|
||||
/*
|
||||
* ioctl commands in 32 bit emulation
|
||||
@@ -275,18 +328,18 @@ struct ext4_mount_options {
|
||||
struct ext4_inode {
|
||||
__le16 i_mode; /* File mode */
|
||||
__le16 i_uid; /* Low 16 bits of Owner Uid */
|
||||
__le32 i_size; /* Size in bytes */
|
||||
__le32 i_size_lo; /* Size in bytes */
|
||||
__le32 i_atime; /* Access time */
|
||||
__le32 i_ctime; /* Inode Change time */
|
||||
__le32 i_mtime; /* Modification time */
|
||||
__le32 i_dtime; /* Deletion Time */
|
||||
__le16 i_gid; /* Low 16 bits of Group Id */
|
||||
__le16 i_links_count; /* Links count */
|
||||
__le32 i_blocks; /* Blocks count */
|
||||
__le32 i_blocks_lo; /* Blocks count */
|
||||
__le32 i_flags; /* File flags */
|
||||
union {
|
||||
struct {
|
||||
__u32 l_i_reserved1;
|
||||
__le32 l_i_version;
|
||||
} linux1;
|
||||
struct {
|
||||
__u32 h_i_translator;
|
||||
@@ -297,12 +350,12 @@ struct ext4_inode {
|
||||
} osd1; /* OS dependent 1 */
|
||||
__le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */
|
||||
__le32 i_generation; /* File version (for NFS) */
|
||||
__le32 i_file_acl; /* File ACL */
|
||||
__le32 i_dir_acl; /* Directory ACL */
|
||||
__le32 i_file_acl_lo; /* File ACL */
|
||||
__le32 i_size_high;
|
||||
__le32 i_obso_faddr; /* Obsoleted fragment address */
|
||||
union {
|
||||
struct {
|
||||
__le16 l_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
|
||||
__le16 l_i_blocks_high; /* were l_i_reserved1 */
|
||||
__le16 l_i_file_acl_high;
|
||||
__le16 l_i_uid_high; /* these 2 fields */
|
||||
__le16 l_i_gid_high; /* were reserved2[0] */
|
||||
@@ -328,9 +381,9 @@ struct ext4_inode {
|
||||
__le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
|
||||
__le32 i_crtime; /* File Creation time */
|
||||
__le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
|
||||
__le32 i_version_hi; /* high 32 bits for 64-bit version */
|
||||
};
|
||||
|
||||
#define i_size_high i_dir_acl
|
||||
|
||||
#define EXT4_EPOCH_BITS 2
|
||||
#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
|
||||
@@ -402,9 +455,12 @@ do { \
|
||||
raw_inode->xtime ## _extra); \
|
||||
} while (0)
|
||||
|
||||
#define i_disk_version osd1.linux1.l_i_version
|
||||
|
||||
#if defined(__KERNEL__) || defined(__linux__)
|
||||
#define i_reserved1 osd1.linux1.l_i_reserved1
|
||||
#define i_file_acl_high osd2.linux2.l_i_file_acl_high
|
||||
#define i_blocks_high osd2.linux2.l_i_blocks_high
|
||||
#define i_uid_low i_uid
|
||||
#define i_gid_low i_gid
|
||||
#define i_uid_high osd2.linux2.l_i_uid_high
|
||||
@@ -461,7 +517,10 @@ do { \
|
||||
#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
|
||||
#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
|
||||
#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
|
||||
|
||||
#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
|
||||
#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
|
||||
#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
|
||||
#define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */
|
||||
/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
|
||||
#ifndef _LINUX_EXT2_FS_H
|
||||
#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
|
||||
@@ -481,6 +540,7 @@ do { \
|
||||
#define ext4_test_bit ext2_test_bit
|
||||
#define ext4_find_first_zero_bit ext2_find_first_zero_bit
|
||||
#define ext4_find_next_zero_bit ext2_find_next_zero_bit
|
||||
#define ext4_find_next_bit ext2_find_next_bit
|
||||
|
||||
/*
|
||||
* Maximal mount counts between two filesystem checks
|
||||
@@ -671,6 +731,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
|
||||
#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
|
||||
#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
|
||||
#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
|
||||
#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
|
||||
#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
|
||||
#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
|
||||
#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
|
||||
@@ -682,6 +743,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
|
||||
#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
|
||||
#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
|
||||
#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
|
||||
#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
|
||||
#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
|
||||
|
||||
#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
|
||||
@@ -696,7 +758,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
|
||||
EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
|
||||
EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
|
||||
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
|
||||
EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
|
||||
EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\
|
||||
EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
|
||||
|
||||
/*
|
||||
* Default values for user and/or group using reserved blocks
|
||||
@@ -767,6 +830,26 @@ struct ext4_dir_entry_2 {
|
||||
#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
|
||||
#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
|
||||
~EXT4_DIR_ROUND)
|
||||
#define EXT4_MAX_REC_LEN ((1<<16)-1)
|
||||
|
||||
static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
|
||||
{
|
||||
unsigned len = le16_to_cpu(dlen);
|
||||
|
||||
if (len == EXT4_MAX_REC_LEN)
|
||||
return 1 << 16;
|
||||
return len;
|
||||
}
|
||||
|
||||
static inline __le16 ext4_rec_len_to_disk(unsigned len)
|
||||
{
|
||||
if (len == (1 << 16))
|
||||
return cpu_to_le16(EXT4_MAX_REC_LEN);
|
||||
else if (len > (1 << 16))
|
||||
BUG();
|
||||
return cpu_to_le16(len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash Tree Directory indexing
|
||||
* (c) Daniel Phillips, 2001
|
||||
@@ -810,7 +893,7 @@ struct ext4_iloc
|
||||
{
|
||||
struct buffer_head *bh;
|
||||
unsigned long offset;
|
||||
unsigned long block_group;
|
||||
ext4_group_t block_group;
|
||||
};
|
||||
|
||||
static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
|
||||
@@ -835,7 +918,7 @@ struct dir_private_info {
|
||||
|
||||
/* calculate the first block number of the group */
|
||||
static inline ext4_fsblk_t
|
||||
ext4_group_first_block_no(struct super_block *sb, unsigned long group_no)
|
||||
ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
|
||||
{
|
||||
return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) +
|
||||
le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
|
||||
@@ -866,21 +949,24 @@ extern unsigned int ext4_block_group(struct super_block *sb,
|
||||
ext4_fsblk_t blocknr);
|
||||
extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb,
|
||||
ext4_fsblk_t blocknr);
|
||||
extern int ext4_bg_has_super(struct super_block *sb, int group);
|
||||
extern unsigned long ext4_bg_num_gdb(struct super_block *sb, int group);
|
||||
extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group);
|
||||
extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
|
||||
ext4_group_t group);
|
||||
extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,
|
||||
ext4_fsblk_t goal, int *errp);
|
||||
extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode,
|
||||
ext4_fsblk_t goal, unsigned long *count, int *errp);
|
||||
extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
|
||||
ext4_fsblk_t goal, unsigned long *count, int *errp);
|
||||
extern void ext4_free_blocks (handle_t *handle, struct inode *inode,
|
||||
ext4_fsblk_t block, unsigned long count);
|
||||
ext4_fsblk_t block, unsigned long count, int metadata);
|
||||
extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb,
|
||||
ext4_fsblk_t block, unsigned long count,
|
||||
unsigned long *pdquot_freed_blocks);
|
||||
extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *);
|
||||
extern void ext4_check_blocks_bitmap (struct super_block *);
|
||||
extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
|
||||
unsigned int block_group,
|
||||
ext4_group_t block_group,
|
||||
struct buffer_head ** bh);
|
||||
extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
|
||||
extern void ext4_init_block_alloc_info(struct inode *);
|
||||
@@ -911,15 +997,32 @@ extern unsigned long ext4_count_dirs (struct super_block *);
|
||||
extern void ext4_check_inodes_bitmap (struct super_block *);
|
||||
extern unsigned long ext4_count_free (struct buffer_head *, unsigned);
|
||||
|
||||
/* mballoc.c */
|
||||
extern long ext4_mb_stats;
|
||||
extern long ext4_mb_max_to_scan;
|
||||
extern int ext4_mb_init(struct super_block *, int);
|
||||
extern int ext4_mb_release(struct super_block *);
|
||||
extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
|
||||
struct ext4_allocation_request *, int *);
|
||||
extern int ext4_mb_reserve_blocks(struct super_block *, int);
|
||||
extern void ext4_mb_discard_inode_preallocations(struct inode *);
|
||||
extern int __init init_ext4_mballoc(void);
|
||||
extern void exit_ext4_mballoc(void);
|
||||
extern void ext4_mb_free_blocks(handle_t *, struct inode *,
|
||||
unsigned long, unsigned long, int, unsigned long *);
|
||||
|
||||
|
||||
/* inode.c */
|
||||
int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
|
||||
struct buffer_head *bh, ext4_fsblk_t blocknr);
|
||||
struct buffer_head * ext4_getblk (handle_t *, struct inode *, long, int, int *);
|
||||
struct buffer_head * ext4_bread (handle_t *, struct inode *, int, int, int *);
|
||||
struct buffer_head *ext4_getblk(handle_t *, struct inode *,
|
||||
ext4_lblk_t, int, int *);
|
||||
struct buffer_head *ext4_bread(handle_t *, struct inode *,
|
||||
ext4_lblk_t, int, int *);
|
||||
int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
|
||||
sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
|
||||
int create, int extend_disksize);
|
||||
ext4_lblk_t iblock, unsigned long maxblocks,
|
||||
struct buffer_head *bh_result,
|
||||
int create, int extend_disksize);
|
||||
|
||||
extern void ext4_read_inode (struct inode *);
|
||||
extern int ext4_write_inode (struct inode *, int);
|
||||
@@ -943,6 +1046,9 @@ extern int ext4_ioctl (struct inode *, struct file *, unsigned int,
|
||||
unsigned long);
|
||||
extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
|
||||
|
||||
/* migrate.c */
|
||||
extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
|
||||
unsigned long);
|
||||
/* namei.c */
|
||||
extern int ext4_orphan_add(handle_t *, struct inode *);
|
||||
extern int ext4_orphan_del(handle_t *, struct inode *);
|
||||
@@ -965,6 +1071,12 @@ extern void ext4_abort (struct super_block *, const char *, const char *, ...)
|
||||
extern void ext4_warning (struct super_block *, const char *, const char *, ...)
|
||||
__attribute__ ((format (printf, 3, 4)));
|
||||
extern void ext4_update_dynamic_rev (struct super_block *sb);
|
||||
extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
|
||||
__u32 compat);
|
||||
extern int ext4_update_rocompat_feature(handle_t *handle,
|
||||
struct super_block *sb, __u32 rocompat);
|
||||
extern int ext4_update_incompat_feature(handle_t *handle,
|
||||
struct super_block *sb, __u32 incompat);
|
||||
extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
|
||||
struct ext4_group_desc *bg);
|
||||
extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
|
||||
@@ -1017,6 +1129,29 @@ static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
|
||||
es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
|
||||
}
|
||||
|
||||
static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
|
||||
{
|
||||
return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
|
||||
le32_to_cpu(raw_inode->i_size_lo);
|
||||
}
|
||||
|
||||
static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
|
||||
{
|
||||
raw_inode->i_size_lo = cpu_to_le32(i_size);
|
||||
raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
|
||||
}
|
||||
|
||||
static inline
|
||||
struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
|
||||
ext4_group_t group)
|
||||
{
|
||||
struct ext4_group_info ***grp_info;
|
||||
long indexv, indexh;
|
||||
grp_info = EXT4_SB(sb)->s_group_info;
|
||||
indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
|
||||
indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
|
||||
return grp_info[indexv][indexh];
|
||||
}
|
||||
|
||||
|
||||
#define ext4_std_error(sb, errno) \
|
||||
@@ -1048,7 +1183,7 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations;
|
||||
extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
|
||||
extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
|
||||
extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
|
||||
ext4_fsblk_t iblock,
|
||||
ext4_lblk_t iblock,
|
||||
unsigned long max_blocks, struct buffer_head *bh_result,
|
||||
int create, int extend_disksize);
|
||||
extern void ext4_ext_truncate(struct inode *, struct page *);
|
||||
@@ -1056,19 +1191,10 @@ extern void ext4_ext_init(struct super_block *);
|
||||
extern void ext4_ext_release(struct super_block *);
|
||||
extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
|
||||
loff_t len);
|
||||
static inline int
|
||||
ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
|
||||
unsigned long max_blocks, struct buffer_head *bh,
|
||||
int create, int extend_disksize)
|
||||
{
|
||||
if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
|
||||
return ext4_ext_get_blocks(handle, inode, block, max_blocks,
|
||||
bh, create, extend_disksize);
|
||||
return ext4_get_blocks_handle(handle, inode, block, max_blocks, bh,
|
||||
create, extend_disksize);
|
||||
}
|
||||
|
||||
|
||||
extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
|
||||
sector_t block, unsigned long max_blocks,
|
||||
struct buffer_head *bh, int create,
|
||||
int extend_disksize);
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _LINUX_EXT4_FS_H */
|
||||
|
@@ -124,20 +124,6 @@ struct ext4_ext_path {
|
||||
#define EXT4_EXT_CACHE_GAP 1
|
||||
#define EXT4_EXT_CACHE_EXTENT 2
|
||||
|
||||
/*
|
||||
* to be called by ext4_ext_walk_space()
|
||||
* negative retcode - error
|
||||
* positive retcode - signal for ext4_ext_walk_space(), see below
|
||||
* callback must return valid extent (passed or newly created)
|
||||
*/
|
||||
typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
|
||||
struct ext4_ext_cache *,
|
||||
void *);
|
||||
|
||||
#define EXT_CONTINUE 0
|
||||
#define EXT_BREAK 1
|
||||
#define EXT_REPEAT 2
|
||||
|
||||
|
||||
#define EXT_MAX_BLOCK 0xffffffff
|
||||
|
||||
@@ -226,6 +212,8 @@ static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
|
||||
(le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
|
||||
}
|
||||
|
||||
extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
|
||||
extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
|
||||
extern int ext4_extent_tree_init(handle_t *, struct inode *);
|
||||
extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
|
||||
extern int ext4_ext_try_to_merge(struct inode *inode,
|
||||
@@ -233,8 +221,11 @@ extern int ext4_ext_try_to_merge(struct inode *inode,
|
||||
struct ext4_extent *);
|
||||
extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
|
||||
extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
|
||||
extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *);
|
||||
extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *);
|
||||
|
||||
extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
|
||||
struct ext4_ext_path *);
|
||||
extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
|
||||
ext4_lblk_t *, ext4_fsblk_t *);
|
||||
extern int ext4_ext_search_right(struct inode *, struct ext4_ext_path *,
|
||||
ext4_lblk_t *, ext4_fsblk_t *);
|
||||
#endif /* _LINUX_EXT4_EXTENTS */
|
||||
|
||||
|
@@ -27,6 +27,12 @@ typedef int ext4_grpblk_t;
|
||||
/* data type for filesystem-wide blocks number */
|
||||
typedef unsigned long long ext4_fsblk_t;
|
||||
|
||||
/* data type for file logical block number */
|
||||
typedef __u32 ext4_lblk_t;
|
||||
|
||||
/* data type for block group number */
|
||||
typedef unsigned long ext4_group_t;
|
||||
|
||||
struct ext4_reserve_window {
|
||||
ext4_fsblk_t _rsv_start; /* First byte reserved */
|
||||
ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */
|
||||
@@ -48,7 +54,7 @@ struct ext4_block_alloc_info {
|
||||
* most-recently-allocated block in this file.
|
||||
* We use this for detecting linearly ascending allocation requests.
|
||||
*/
|
||||
__u32 last_alloc_logical_block;
|
||||
ext4_lblk_t last_alloc_logical_block;
|
||||
/*
|
||||
* Was i_next_alloc_goal in ext4_inode_info
|
||||
* is the *physical* companion to i_next_alloc_block.
|
||||
@@ -67,7 +73,7 @@ struct ext4_block_alloc_info {
|
||||
*/
|
||||
struct ext4_ext_cache {
|
||||
ext4_fsblk_t ec_start;
|
||||
__u32 ec_block;
|
||||
ext4_lblk_t ec_block;
|
||||
__u32 ec_len; /* must be 32bit to return holes */
|
||||
__u32 ec_type;
|
||||
};
|
||||
@@ -79,7 +85,6 @@ struct ext4_inode_info {
|
||||
__le32 i_data[15]; /* unconverted */
|
||||
__u32 i_flags;
|
||||
ext4_fsblk_t i_file_acl;
|
||||
__u32 i_dir_acl;
|
||||
__u32 i_dtime;
|
||||
|
||||
/*
|
||||
@@ -89,13 +94,13 @@ struct ext4_inode_info {
|
||||
* place a file's data blocks near its inode block, and new inodes
|
||||
* near to their parent directory's inode.
|
||||
*/
|
||||
__u32 i_block_group;
|
||||
ext4_group_t i_block_group;
|
||||
__u32 i_state; /* Dynamic state flags for ext4 */
|
||||
|
||||
/* block reservation info */
|
||||
struct ext4_block_alloc_info *i_block_alloc_info;
|
||||
|
||||
__u32 i_dir_start_lookup;
|
||||
ext4_lblk_t i_dir_start_lookup;
|
||||
#ifdef CONFIG_EXT4DEV_FS_XATTR
|
||||
/*
|
||||
* Extended attributes can be read independently of the main file
|
||||
@@ -134,16 +139,16 @@ struct ext4_inode_info {
|
||||
__u16 i_extra_isize;
|
||||
|
||||
/*
|
||||
* truncate_mutex is for serialising ext4_truncate() against
|
||||
* i_data_sem is for serialising ext4_truncate() against
|
||||
* ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's
|
||||
* data tree are chopped off during truncate. We can't do that in
|
||||
* ext4 because whenever we perform intermediate commits during
|
||||
* truncate, the inode and all the metadata blocks *must* be in a
|
||||
* consistent state which allows truncation of the orphans to restart
|
||||
* during recovery. Hence we must fix the get_block-vs-truncate race
|
||||
* by other means, so we have truncate_mutex.
|
||||
* by other means, so we have i_data_sem.
|
||||
*/
|
||||
struct mutex truncate_mutex;
|
||||
struct rw_semaphore i_data_sem;
|
||||
struct inode vfs_inode;
|
||||
|
||||
unsigned long i_ext_generation;
|
||||
@@ -153,6 +158,10 @@ struct ext4_inode_info {
|
||||
* struct timespec i_{a,c,m}time in the generic inode.
|
||||
*/
|
||||
struct timespec i_crtime;
|
||||
|
||||
/* mballoc */
|
||||
struct list_head i_prealloc_list;
|
||||
spinlock_t i_prealloc_lock;
|
||||
};
|
||||
|
||||
#endif /* _LINUX_EXT4_FS_I */
|
||||
|
@@ -35,9 +35,10 @@ struct ext4_sb_info {
|
||||
unsigned long s_itb_per_group; /* Number of inode table blocks per group */
|
||||
unsigned long s_gdb_count; /* Number of group descriptor blocks */
|
||||
unsigned long s_desc_per_block; /* Number of group descriptors per block */
|
||||
unsigned long s_groups_count; /* Number of groups in the fs */
|
||||
ext4_group_t s_groups_count; /* Number of groups in the fs */
|
||||
unsigned long s_overhead_last; /* Last calculated overhead */
|
||||
unsigned long s_blocks_last; /* Last seen block count */
|
||||
loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
|
||||
struct buffer_head * s_sbh; /* Buffer containing the super block */
|
||||
struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
|
||||
struct buffer_head ** s_group_desc;
|
||||
@@ -90,6 +91,58 @@ struct ext4_sb_info {
|
||||
unsigned long s_ext_blocks;
|
||||
unsigned long s_ext_extents;
|
||||
#endif
|
||||
|
||||
/* for buddy allocator */
|
||||
struct ext4_group_info ***s_group_info;
|
||||
struct inode *s_buddy_cache;
|
||||
long s_blocks_reserved;
|
||||
spinlock_t s_reserve_lock;
|
||||
struct list_head s_active_transaction;
|
||||
struct list_head s_closed_transaction;
|
||||
struct list_head s_committed_transaction;
|
||||
spinlock_t s_md_lock;
|
||||
tid_t s_last_transaction;
|
||||
unsigned short *s_mb_offsets, *s_mb_maxs;
|
||||
|
||||
/* tunables */
|
||||
unsigned long s_stripe;
|
||||
unsigned long s_mb_stream_request;
|
||||
unsigned long s_mb_max_to_scan;
|
||||
unsigned long s_mb_min_to_scan;
|
||||
unsigned long s_mb_stats;
|
||||
unsigned long s_mb_order2_reqs;
|
||||
unsigned long s_mb_group_prealloc;
|
||||
/* where last allocation was done - for stream allocation */
|
||||
unsigned long s_mb_last_group;
|
||||
unsigned long s_mb_last_start;
|
||||
|
||||
/* history to debug policy */
|
||||
struct ext4_mb_history *s_mb_history;
|
||||
int s_mb_history_cur;
|
||||
int s_mb_history_max;
|
||||
int s_mb_history_num;
|
||||
struct proc_dir_entry *s_mb_proc;
|
||||
spinlock_t s_mb_history_lock;
|
||||
int s_mb_history_filter;
|
||||
|
||||
/* stats for buddy allocator */
|
||||
spinlock_t s_mb_pa_lock;
|
||||
atomic_t s_bal_reqs; /* number of reqs with len > 1 */
|
||||
atomic_t s_bal_success; /* we found long enough chunks */
|
||||
atomic_t s_bal_allocated; /* in blocks */
|
||||
atomic_t s_bal_ex_scanned; /* total extents scanned */
|
||||
atomic_t s_bal_goals; /* goal hits */
|
||||
atomic_t s_bal_breaks; /* too long searches */
|
||||
atomic_t s_bal_2orders; /* 2^order hits */
|
||||
spinlock_t s_bal_lock;
|
||||
unsigned long s_mb_buddies_generated;
|
||||
unsigned long long s_mb_generation_time;
|
||||
atomic_t s_mb_lost_chunks;
|
||||
atomic_t s_mb_preallocated;
|
||||
atomic_t s_mb_discarded;
|
||||
|
||||
/* locality groups */
|
||||
struct ext4_locality_group *s_locality_groups;
|
||||
};
|
||||
|
||||
#endif /* _LINUX_EXT4_FS_SB */
|
||||
|
@@ -124,6 +124,7 @@ extern int dir_notify_enable;
|
||||
#define MS_SHARED (1<<20) /* change to shared */
|
||||
#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
|
||||
#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
|
||||
#define MS_I_VERSION (1<<23) /* Update inode I_version field */
|
||||
#define MS_ACTIVE (1<<30)
|
||||
#define MS_NOUSER (1<<31)
|
||||
|
||||
@@ -173,6 +174,7 @@ extern int dir_notify_enable;
|
||||
((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
|
||||
#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
|
||||
#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
|
||||
#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
|
||||
|
||||
#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
|
||||
#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
|
||||
@@ -599,7 +601,7 @@ struct inode {
|
||||
uid_t i_uid;
|
||||
gid_t i_gid;
|
||||
dev_t i_rdev;
|
||||
unsigned long i_version;
|
||||
u64 i_version;
|
||||
loff_t i_size;
|
||||
#ifdef __NEED_I_SIZE_ORDERED
|
||||
seqcount_t i_size_seqcount;
|
||||
@@ -1394,6 +1396,21 @@ static inline void inode_dec_link_count(struct inode *inode)
|
||||
mark_inode_dirty(inode);
|
||||
}
|
||||
|
||||
/**
|
||||
* inode_inc_iversion - increments i_version
|
||||
* @inode: inode that need to be updated
|
||||
*
|
||||
* Every time the inode is modified, the i_version field will be incremented.
|
||||
* The filesystem has to be mounted with i_version flag
|
||||
*/
|
||||
|
||||
static inline void inode_inc_iversion(struct inode *inode)
|
||||
{
|
||||
spin_lock(&inode->i_lock);
|
||||
inode->i_version++;
|
||||
spin_unlock(&inode->i_lock);
|
||||
}
|
||||
|
||||
extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
|
||||
static inline void file_accessed(struct file *file)
|
||||
{
|
||||
@@ -1476,7 +1493,7 @@ extern void drop_collected_mounts(struct vfsmount *);
|
||||
extern int vfs_statfs(struct dentry *, struct kstatfs *);
|
||||
|
||||
/* /sys/fs */
|
||||
extern struct kset fs_subsys;
|
||||
extern struct kobject *fs_kobj;
|
||||
|
||||
#define FLOCK_VERIFY_READ 1
|
||||
#define FLOCK_VERIFY_WRITE 2
|
||||
|
@@ -1,8 +1,12 @@
|
||||
#ifndef _LINUX_FUTEX_H
|
||||
#define _LINUX_FUTEX_H
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct inode;
|
||||
struct mm_struct;
|
||||
struct task_struct;
|
||||
union ktime;
|
||||
|
||||
/* Second argument to futex syscall */
|
||||
|
@@ -10,9 +10,19 @@
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/kdev_t.h>
|
||||
|
||||
#ifdef CONFIG_BLOCK
|
||||
|
||||
#define kobj_to_dev(k) container_of(k, struct device, kobj)
|
||||
#define dev_to_disk(device) container_of(device, struct gendisk, dev)
|
||||
#define dev_to_part(device) container_of(device, struct hd_struct, dev)
|
||||
|
||||
extern struct device_type disk_type;
|
||||
extern struct device_type part_type;
|
||||
extern struct kobject *block_depr;
|
||||
extern struct class block_class;
|
||||
|
||||
enum {
|
||||
/* These three have identical behaviour; use the second one if DOS FDISK gets
|
||||
confused about extended/logical partitions starting past cylinder 1023. */
|
||||
@@ -84,7 +94,7 @@ struct partition {
|
||||
struct hd_struct {
|
||||
sector_t start_sect;
|
||||
sector_t nr_sects;
|
||||
struct kobject kobj;
|
||||
struct device dev;
|
||||
struct kobject *holder_dir;
|
||||
unsigned ios[2], sectors[2]; /* READs and WRITEs */
|
||||
int policy, partno;
|
||||
@@ -117,15 +127,14 @@ struct gendisk {
|
||||
* disks that can't be partitioned. */
|
||||
char disk_name[32]; /* name of major driver */
|
||||
struct hd_struct **part; /* [indexed by minor] */
|
||||
int part_uevent_suppress;
|
||||
struct block_device_operations *fops;
|
||||
struct request_queue *queue;
|
||||
void *private_data;
|
||||
sector_t capacity;
|
||||
|
||||
int flags;
|
||||
struct device *driverfs_dev;
|
||||
struct kobject kobj;
|
||||
struct device *driverfs_dev; // FIXME: remove
|
||||
struct device dev;
|
||||
struct kobject *holder_dir;
|
||||
struct kobject *slave_dir;
|
||||
|
||||
@@ -143,13 +152,6 @@ struct gendisk {
|
||||
struct work_struct async_notify;
|
||||
};
|
||||
|
||||
/* Structure for sysfs attributes on block devices */
|
||||
struct disk_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct gendisk *, char *);
|
||||
ssize_t (*store)(struct gendisk *, const char *, size_t);
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros to operate on percpu disk statistics:
|
||||
*
|
||||
@@ -411,7 +413,8 @@ struct unixware_disklabel {
|
||||
#define ADDPART_FLAG_RAID 1
|
||||
#define ADDPART_FLAG_WHOLEDISK 2
|
||||
|
||||
char *disk_name (struct gendisk *hd, int part, char *buf);
|
||||
extern dev_t blk_lookup_devt(const char *name);
|
||||
extern char *disk_name (struct gendisk *hd, int part, char *buf);
|
||||
|
||||
extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
|
||||
extern void add_partition(struct gendisk *, int, sector_t, sector_t, int);
|
||||
@@ -423,12 +426,12 @@ extern struct gendisk *alloc_disk(int minors);
|
||||
extern struct kobject *get_disk(struct gendisk *disk);
|
||||
extern void put_disk(struct gendisk *disk);
|
||||
extern void genhd_media_change_notify(struct gendisk *disk);
|
||||
extern void blk_register_region(dev_t dev, unsigned long range,
|
||||
extern void blk_register_region(dev_t devt, unsigned long range,
|
||||
struct module *module,
|
||||
struct kobject *(*probe)(dev_t, int *, void *),
|
||||
int (*lock)(dev_t, void *),
|
||||
void *data);
|
||||
extern void blk_unregister_region(dev_t dev, unsigned long range);
|
||||
extern void blk_unregister_region(dev_t devt, unsigned long range);
|
||||
|
||||
static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
|
||||
{
|
||||
@@ -441,6 +444,12 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
|
||||
|
||||
static inline void printk_all_partitions(void) { }
|
||||
|
||||
static inline dev_t blk_lookup_devt(const char *name)
|
||||
{
|
||||
dev_t devt = MKDEV(0, 0);
|
||||
return devt;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BLOCK */
|
||||
|
||||
#endif
|
||||
|
@@ -72,11 +72,7 @@
|
||||
#define in_softirq() (softirq_count())
|
||||
#define in_interrupt() (irq_count())
|
||||
|
||||
#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
|
||||
# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
|
||||
#else
|
||||
# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
|
||||
#endif
|
||||
#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
|
||||
|
||||
#ifdef CONFIG_PREEMPT
|
||||
# define PREEMPT_CHECK_OFFSET 1
|
||||
|
@@ -44,7 +44,9 @@
|
||||
|
||||
/* Bits for HD_ERROR */
|
||||
#define MARK_ERR 0x01 /* Bad address mark */
|
||||
#define ILI_ERR 0x01 /* Illegal Length Indication (ATAPI) */
|
||||
#define TRK0_ERR 0x02 /* couldn't find track 0 */
|
||||
#define EOM_ERR 0x02 /* End Of Media (ATAPI) */
|
||||
#define ABRT_ERR 0x04 /* Command aborted */
|
||||
#define MCR_ERR 0x08 /* media change request */
|
||||
#define ID_ERR 0x10 /* ID field not found */
|
||||
@@ -52,6 +54,7 @@
|
||||
#define ECC_ERR 0x40 /* Uncorrectable ECC error */
|
||||
#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
|
||||
#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
|
||||
#define LFS_ERR 0xf0 /* Last Failed Sense (ATAPI) */
|
||||
|
||||
/* Bits of HD_NSECTOR */
|
||||
#define CD 0x01
|
||||
@@ -70,13 +73,13 @@
|
||||
#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
|
||||
#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
|
||||
|
||||
#define IDE_DRIVE_TASK_INVALID -1
|
||||
#define IDE_DRIVE_TASK_NO_DATA 0
|
||||
#ifndef __KERNEL__
|
||||
#define IDE_DRIVE_TASK_INVALID -1
|
||||
#define IDE_DRIVE_TASK_SET_XFER 1
|
||||
|
||||
#define IDE_DRIVE_TASK_IN 2
|
||||
|
||||
#define IDE_DRIVE_TASK_OUT 3
|
||||
#endif
|
||||
#define IDE_DRIVE_TASK_RAW_WRITE 4
|
||||
|
||||
/*
|
||||
@@ -87,10 +90,10 @@
|
||||
#ifndef __KERNEL__
|
||||
#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
|
||||
#define IDE_HOB_STD_OUT_FLAGS 0x3C
|
||||
#endif
|
||||
|
||||
typedef unsigned char task_ioreg_t;
|
||||
typedef unsigned long sata_ioreg_t;
|
||||
#endif
|
||||
|
||||
typedef union ide_reg_valid_s {
|
||||
unsigned all : 16;
|
||||
@@ -116,8 +119,8 @@ typedef union ide_reg_valid_s {
|
||||
} ide_reg_valid_t;
|
||||
|
||||
typedef struct ide_task_request_s {
|
||||
task_ioreg_t io_ports[8];
|
||||
task_ioreg_t hob_ports[8];
|
||||
__u8 io_ports[8];
|
||||
__u8 hob_ports[8]; /* bytes 6 and 7 are unused */
|
||||
ide_reg_valid_t out_flags;
|
||||
ide_reg_valid_t in_flags;
|
||||
int data_phase;
|
||||
@@ -133,36 +136,35 @@ typedef struct ide_ioctl_request_s {
|
||||
} ide_ioctl_request_t;
|
||||
|
||||
struct hd_drive_cmd_hdr {
|
||||
task_ioreg_t command;
|
||||
task_ioreg_t sector_number;
|
||||
task_ioreg_t feature;
|
||||
task_ioreg_t sector_count;
|
||||
__u8 command;
|
||||
__u8 sector_number;
|
||||
__u8 feature;
|
||||
__u8 sector_count;
|
||||
};
|
||||
|
||||
#ifndef __KERNEL__
|
||||
typedef struct hd_drive_task_hdr {
|
||||
task_ioreg_t data;
|
||||
task_ioreg_t feature;
|
||||
task_ioreg_t sector_count;
|
||||
task_ioreg_t sector_number;
|
||||
task_ioreg_t low_cylinder;
|
||||
task_ioreg_t high_cylinder;
|
||||
task_ioreg_t device_head;
|
||||
task_ioreg_t command;
|
||||
__u8 data;
|
||||
__u8 feature;
|
||||
__u8 sector_count;
|
||||
__u8 sector_number;
|
||||
__u8 low_cylinder;
|
||||
__u8 high_cylinder;
|
||||
__u8 device_head;
|
||||
__u8 command;
|
||||
} task_struct_t;
|
||||
|
||||
typedef struct hd_drive_hob_hdr {
|
||||
task_ioreg_t data;
|
||||
task_ioreg_t feature;
|
||||
task_ioreg_t sector_count;
|
||||
task_ioreg_t sector_number;
|
||||
task_ioreg_t low_cylinder;
|
||||
task_ioreg_t high_cylinder;
|
||||
task_ioreg_t device_head;
|
||||
task_ioreg_t control;
|
||||
__u8 data;
|
||||
__u8 feature;
|
||||
__u8 sector_count;
|
||||
__u8 sector_number;
|
||||
__u8 low_cylinder;
|
||||
__u8 high_cylinder;
|
||||
__u8 device_head;
|
||||
__u8 control;
|
||||
} hob_struct_t;
|
||||
|
||||
#define TASKFILE_INVALID 0x7fff
|
||||
#define TASKFILE_48 0x8000
|
||||
#endif
|
||||
|
||||
#define TASKFILE_NO_DATA 0x0000
|
||||
|
||||
@@ -178,12 +180,16 @@ typedef struct hd_drive_hob_hdr {
|
||||
#define TASKFILE_IN_DMAQ 0x0080
|
||||
#define TASKFILE_OUT_DMAQ 0x0100
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#define TASKFILE_P_IN 0x0200
|
||||
#define TASKFILE_P_OUT 0x0400
|
||||
#define TASKFILE_P_IN_DMA 0x0800
|
||||
#define TASKFILE_P_OUT_DMA 0x1000
|
||||
#define TASKFILE_P_IN_DMAQ 0x2000
|
||||
#define TASKFILE_P_OUT_DMAQ 0x4000
|
||||
#define TASKFILE_48 0x8000
|
||||
#define TASKFILE_INVALID 0x7fff
|
||||
#endif
|
||||
|
||||
/* ATA/ATAPI Commands pre T13 Spec */
|
||||
#define WIN_NOP 0x00
|
||||
|
@@ -267,10 +267,10 @@ struct hid_item {
|
||||
#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100
|
||||
#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200
|
||||
#define HID_QUIRK_MIGHTYMOUSE 0x00000400
|
||||
#define HID_QUIRK_POWERBOOK_HAS_FN 0x00000800
|
||||
#define HID_QUIRK_POWERBOOK_FN_ON 0x00001000
|
||||
#define HID_QUIRK_APPLE_HAS_FN 0x00000800
|
||||
#define HID_QUIRK_APPLE_FN_ON 0x00001000
|
||||
#define HID_QUIRK_INVERT_HWHEEL 0x00002000
|
||||
#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00004000
|
||||
#define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000
|
||||
#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000
|
||||
#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
|
||||
#define HID_QUIRK_IGNORE_MOUSE 0x00020000
|
||||
@@ -281,6 +281,9 @@ struct hid_item {
|
||||
#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
|
||||
#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
|
||||
#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
|
||||
#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
|
||||
#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
|
||||
#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
|
||||
|
||||
/*
|
||||
* Separate quirks for runtime report descriptor fixup
|
||||
@@ -291,6 +294,8 @@ struct hid_item {
|
||||
#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
|
||||
#define HID_QUIRK_RDESC_PETALYNX 0x00000008
|
||||
#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
|
||||
#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
|
||||
#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
|
||||
|
||||
/*
|
||||
* This is the global environment of the parser. This information is
|
||||
@@ -456,6 +461,8 @@ struct hid_device { /* device report descriptor */
|
||||
|
||||
void *driver_data;
|
||||
|
||||
__s32 delayed_value; /* For A4 Tech mice hwheel quirk */
|
||||
|
||||
/* device-specific function pointers */
|
||||
int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int);
|
||||
int (*hid_open) (struct hid_device *);
|
||||
@@ -469,7 +476,7 @@ struct hid_device { /* device report descriptor */
|
||||
/* handler for raw output data, used by hidraw */
|
||||
int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
|
||||
#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
|
||||
unsigned long pb_pressed_fn[BITS_TO_LONGS(KEY_CNT)];
|
||||
unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)];
|
||||
unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)];
|
||||
#endif
|
||||
};
|
||||
@@ -520,6 +527,9 @@ extern void hidinput_disconnect(struct hid_device *);
|
||||
int hid_set_field(struct hid_field *, unsigned, __s32);
|
||||
int hid_input_report(struct hid_device *, int type, u8 *, int, int);
|
||||
int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
|
||||
int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
|
||||
void hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
|
||||
int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
|
||||
void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt);
|
||||
void hid_output_report(struct hid_report *report, __u8 *data);
|
||||
void hid_free_device(struct hid_device *device);
|
||||
|
@@ -64,7 +64,7 @@ struct hpet {
|
||||
*/
|
||||
|
||||
#define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL)
|
||||
#define Tn_INI_ROUTE_CAP_SHIFT (32UL)
|
||||
#define Tn_INT_ROUTE_CAP_SHIFT (32UL)
|
||||
#define Tn_FSB_INT_DELCAP_MASK (0x8000UL)
|
||||
#define Tn_FSB_INT_DELCAP_SHIFT (15)
|
||||
#define Tn_FSB_EN_CNF_MASK (0x4000UL)
|
||||
@@ -115,9 +115,6 @@ static inline void hpet_reserve_timer(struct hpet_data *hd, int timer)
|
||||
}
|
||||
|
||||
int hpet_alloc(struct hpet_data *);
|
||||
int hpet_register(struct hpet_task *, int);
|
||||
int hpet_unregister(struct hpet_task *);
|
||||
int hpet_control(struct hpet_task *, unsigned int, unsigned long);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
@@ -115,10 +115,8 @@ struct hrtimer {
|
||||
enum hrtimer_restart (*function)(struct hrtimer *);
|
||||
struct hrtimer_clock_base *base;
|
||||
unsigned long state;
|
||||
#ifdef CONFIG_HIGH_RES_TIMERS
|
||||
enum hrtimer_cb_mode cb_mode;
|
||||
struct list_head cb_entry;
|
||||
#endif
|
||||
#ifdef CONFIG_TIMER_STATS
|
||||
void *start_site;
|
||||
char start_comm[16];
|
||||
@@ -194,10 +192,10 @@ struct hrtimer_cpu_base {
|
||||
spinlock_t lock;
|
||||
struct lock_class_key lock_key;
|
||||
struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
|
||||
struct list_head cb_pending;
|
||||
#ifdef CONFIG_HIGH_RES_TIMERS
|
||||
ktime_t expires_next;
|
||||
int hres_active;
|
||||
struct list_head cb_pending;
|
||||
unsigned long nr_events;
|
||||
#endif
|
||||
};
|
||||
@@ -217,6 +215,11 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
|
||||
return timer->base->get_time();
|
||||
}
|
||||
|
||||
static inline int hrtimer_is_hres_active(struct hrtimer *timer)
|
||||
{
|
||||
return timer->base->cpu_base->hres_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* The resolution of the clocks. The resolution value is returned in
|
||||
* the clock_getres() system call to give application programmers an
|
||||
@@ -248,6 +251,10 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
|
||||
return timer->base->softirq_time;
|
||||
}
|
||||
|
||||
static inline int hrtimer_is_hres_active(struct hrtimer *timer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern ktime_t ktime_get(void);
|
||||
@@ -310,6 +317,7 @@ extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
|
||||
|
||||
/* Soft interrupt function to run the hrtimer queues: */
|
||||
extern void hrtimer_run_queues(void);
|
||||
extern void hrtimer_run_pending(void);
|
||||
|
||||
/* Bootup initialization: */
|
||||
extern void __init hrtimers_init(void);
|
||||
|
@@ -33,7 +33,7 @@ struct hwrng {
|
||||
const char *name;
|
||||
int (*init)(struct hwrng *rng);
|
||||
void (*cleanup)(struct hwrng *rng);
|
||||
int (*data_present)(struct hwrng *rng);
|
||||
int (*data_present)(struct hwrng *rng, int wait);
|
||||
int (*data_read)(struct hwrng *rng, u32 *data);
|
||||
unsigned long priv;
|
||||
|
||||
|
@@ -33,23 +33,13 @@
|
||||
|
||||
#define I2C_DRIVERID_MSP3400 1
|
||||
#define I2C_DRIVERID_TUNER 2
|
||||
#define I2C_DRIVERID_VIDEOTEX 3 /* please rename */
|
||||
#define I2C_DRIVERID_TDA8425 4 /* stereo sound processor */
|
||||
#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */
|
||||
#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */
|
||||
#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */
|
||||
#define I2C_DRIVERID_SAA7111A 8 /* video input processor */
|
||||
#define I2C_DRIVERID_SAA5281 9 /* videotext decoder */
|
||||
#define I2C_DRIVERID_SAA7112 10 /* video decoder, image scaler */
|
||||
#define I2C_DRIVERID_SAA7120 11 /* video encoder */
|
||||
#define I2C_DRIVERID_SAA7121 12 /* video encoder */
|
||||
#define I2C_DRIVERID_SAA7185B 13 /* video encoder */
|
||||
#define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */
|
||||
#define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */
|
||||
#define I2C_DRIVERID_PCF8582C 16 /* eeprom */
|
||||
#define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */
|
||||
#define I2C_DRIVERID_TEA6300 18 /* audio mixer */
|
||||
#define I2C_DRIVERID_BT829 19 /* pc to tv encoder */
|
||||
#define I2C_DRIVERID_TDA9850 20 /* audio mixer */
|
||||
#define I2C_DRIVERID_TDA9855 21 /* audio mixer */
|
||||
#define I2C_DRIVERID_SAA7110 22 /* video decoder */
|
||||
@@ -60,42 +50,19 @@
|
||||
#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
|
||||
#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */
|
||||
#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
|
||||
#define I2C_DRIVERID_DPL3518 30 /* Dolby decoder chip */
|
||||
#define I2C_DRIVERID_TDA9873 31 /* TV sound decoder chip */
|
||||
#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */
|
||||
#define I2C_DRIVERID_PIC16C54_PV9 33 /* Audio mux/ir receiver */
|
||||
|
||||
#define I2C_DRIVERID_SBATT 34 /* Smart Battery Device */
|
||||
#define I2C_DRIVERID_SBS 35 /* SB System Manager */
|
||||
#define I2C_DRIVERID_VES1893 36 /* VLSI DVB-S decoder */
|
||||
#define I2C_DRIVERID_VES1820 37 /* VLSI DVB-C decoder */
|
||||
#define I2C_DRIVERID_SAA7113 38 /* video decoder */
|
||||
#define I2C_DRIVERID_TDA8444 39 /* octuple 6-bit DAC */
|
||||
#define I2C_DRIVERID_BT819 40 /* video decoder */
|
||||
#define I2C_DRIVERID_BT856 41 /* video encoder */
|
||||
#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */
|
||||
#define I2C_DRIVERID_DRP3510 43 /* ADR decoder (Astra Radio) */
|
||||
#define I2C_DRIVERID_SP5055 44 /* Satellite tuner */
|
||||
#define I2C_DRIVERID_STV0030 45 /* Multipurpose switch */
|
||||
#define I2C_DRIVERID_SAA7108 46 /* video decoder, image scaler */
|
||||
#define I2C_DRIVERID_DS1307 47 /* DS1307 real time clock */
|
||||
#define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */
|
||||
#define I2C_DRIVERID_SAA7114 49 /* video decoder */
|
||||
#define I2C_DRIVERID_ZR36120 50 /* Zoran 36120 video encoder */
|
||||
#define I2C_DRIVERID_24LC32A 51 /* Microchip 24LC32A 32k EEPROM */
|
||||
#define I2C_DRIVERID_STM41T00 52 /* real time clock */
|
||||
#define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */
|
||||
#define I2C_DRIVERID_ADV7170 54 /* video encoder */
|
||||
#define I2C_DRIVERID_MAX1617 56 /* temp sensor */
|
||||
#define I2C_DRIVERID_SAA7191 57 /* video decoder */
|
||||
#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */
|
||||
#define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */
|
||||
#define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */
|
||||
#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */
|
||||
#define I2C_DRIVERID_TDA7313 62 /* TDA7313 audio processor */
|
||||
#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */
|
||||
#define I2C_DRIVERID_SAA7114H 64 /* video decoder */
|
||||
#define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */
|
||||
#define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */
|
||||
#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */
|
||||
#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */
|
||||
@@ -114,7 +81,6 @@
|
||||
#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */
|
||||
#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
|
||||
#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
|
||||
#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */
|
||||
#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
|
||||
#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
|
||||
#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
|
||||
@@ -125,10 +91,10 @@
|
||||
#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */
|
||||
#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
|
||||
#define I2C_DRIVERID_CS4270 94 /* Cirrus Logic 4270 audio codec */
|
||||
#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
|
||||
#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
|
||||
|
||||
#define I2C_DRIVERID_I2CDEV 900
|
||||
#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
|
||||
#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */
|
||||
|
||||
/* IDs -- Use DRIVERIDs 1000-1999 for sensors.
|
||||
These were originally in sensors.h in the lm_sensors package */
|
||||
@@ -174,24 +140,16 @@
|
||||
|
||||
/* --- Bit algorithm adapters */
|
||||
#define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */
|
||||
#define I2C_HW_B_SER 0x010002 /* Serial line interface */
|
||||
#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
|
||||
#define I2C_HW_B_WNV 0x010006 /* Winnov Videums */
|
||||
#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */
|
||||
#define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */
|
||||
#define I2C_HW_B_G400 0x010009 /* Matrox G400 */
|
||||
#define I2C_HW_B_I810 0x01000a /* Intel I810 */
|
||||
#define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */
|
||||
#define I2C_HW_B_PPORT 0x01000c /* Primitive parallel port adapter */
|
||||
#define I2C_HW_B_SAVG 0x01000d /* Savage 4 */
|
||||
#define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */
|
||||
#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
|
||||
#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
|
||||
#define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */
|
||||
#define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */
|
||||
#define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */
|
||||
#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
|
||||
#define I2C_HW_B_IXP4XX 0x010017 /* GPIO on IXP4XX systems */
|
||||
#define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */
|
||||
#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */
|
||||
#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */
|
||||
@@ -205,22 +163,11 @@
|
||||
#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
|
||||
|
||||
/* --- PCF 8584 based algorithms */
|
||||
#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
|
||||
#define I2C_HW_P_ISA 0x020001 /* generic ISA Bus inteface card */
|
||||
#define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */
|
||||
|
||||
/* --- PCA 9564 based algorithms */
|
||||
#define I2C_HW_A_ISA 0x1a0000 /* generic ISA Bus interface card */
|
||||
|
||||
/* --- ACPI Embedded controller algorithms */
|
||||
#define I2C_HW_ACPI_EC 0x1f0000
|
||||
|
||||
/* --- MPC824x PowerPC adapters */
|
||||
#define I2C_HW_MPC824X 0x100001 /* Motorola 8240 / 8245 */
|
||||
|
||||
/* --- MPC8xx PowerPC adapters */
|
||||
#define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */
|
||||
|
||||
/* --- PowerPC on-chip adapters */
|
||||
#define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */
|
||||
|
||||
@@ -229,7 +176,6 @@
|
||||
|
||||
/* --- SGI adapters */
|
||||
#define I2C_HW_SGI_VINO 0x160000
|
||||
#define I2C_HW_SGI_MACE 0x160001
|
||||
|
||||
/* --- XSCALE on-chip adapters */
|
||||
#define I2C_HW_IOP3XX 0x140000
|
||||
@@ -253,17 +199,10 @@
|
||||
#define I2C_HW_SMBUS_W9968CF 0x04000d
|
||||
#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */
|
||||
#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */
|
||||
#define I2C_HW_SMBUS_OV519 0x040010 /* OV519 USB 1.1 webcam IC */
|
||||
#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */
|
||||
#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */
|
||||
#define I2C_HW_SMBUS_ALI1563 0x040013
|
||||
|
||||
/* --- ISA pseudo-adapter */
|
||||
#define I2C_HW_ISA 0x050000
|
||||
|
||||
/* --- IPMB adapter */
|
||||
#define I2C_HW_IPMB 0x0c0000
|
||||
|
||||
/* --- MCP107 adapter */
|
||||
#define I2C_HW_MPC107 0x0d0000
|
||||
|
||||
|
@@ -140,7 +140,6 @@ struct i2c_driver {
|
||||
int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
|
||||
|
||||
struct device_driver driver;
|
||||
struct list_head list;
|
||||
};
|
||||
#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
|
||||
|
||||
@@ -155,12 +154,11 @@ struct i2c_driver {
|
||||
* generic enough to hide second-sourcing and compatible revisions.
|
||||
* @adapter: manages the bus segment hosting this I2C device
|
||||
* @driver: device's driver, hence pointer to access routines
|
||||
* @usage_count: counts current number of users of this client
|
||||
* @dev: Driver model device node for the slave.
|
||||
* @irq: indicates the IRQ generated by this device (if any)
|
||||
* @driver_name: Identifies new-style driver used with this device; also
|
||||
* used as the module name for hotplug/coldplug modprobe support.
|
||||
* @list: list of active/busy clients
|
||||
* @list: list of active/busy clients (DEPRECATED)
|
||||
* @released: used to synchronize client releases & detaches and references
|
||||
*
|
||||
* An i2c_client identifies a single device (i.e. chip) connected to an
|
||||
@@ -175,16 +173,16 @@ struct i2c_client {
|
||||
char name[I2C_NAME_SIZE];
|
||||
struct i2c_adapter *adapter; /* the adapter we sit on */
|
||||
struct i2c_driver *driver; /* and our access routines */
|
||||
int usage_count; /* How many accesses currently */
|
||||
/* to the client */
|
||||
struct device dev; /* the device structure */
|
||||
int irq; /* irq issued by device (or -1) */
|
||||
char driver_name[KOBJ_NAME_LEN];
|
||||
struct list_head list;
|
||||
struct list_head list; /* DEPRECATED */
|
||||
struct completion released;
|
||||
};
|
||||
#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
|
||||
|
||||
extern struct i2c_client *i2c_verify_client(struct device *dev);
|
||||
|
||||
static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
|
||||
{
|
||||
struct device * const dev = container_of(kobj, struct device, kobj);
|
||||
@@ -261,6 +259,12 @@ i2c_new_probed_device(struct i2c_adapter *adap,
|
||||
struct i2c_board_info *info,
|
||||
unsigned short const *addr_list);
|
||||
|
||||
/* For devices that use several addresses, use i2c_new_dummy() to make
|
||||
* client handles for the extra addresses.
|
||||
*/
|
||||
extern struct i2c_client *
|
||||
i2c_new_dummy(struct i2c_adapter *adap, u16 address, const char *type);
|
||||
|
||||
extern void i2c_unregister_device(struct i2c_client *);
|
||||
|
||||
/* Mainboard arch_initcall() code should register all its I2C devices.
|
||||
@@ -319,8 +323,7 @@ struct i2c_adapter {
|
||||
struct device dev; /* the adapter device */
|
||||
|
||||
int nr;
|
||||
struct list_head clients;
|
||||
struct list_head list;
|
||||
struct list_head clients; /* DEPRECATED */
|
||||
char name[48];
|
||||
struct completion dev_released;
|
||||
};
|
||||
@@ -357,10 +360,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
|
||||
* command line
|
||||
*/
|
||||
struct i2c_client_address_data {
|
||||
unsigned short *normal_i2c;
|
||||
unsigned short *probe;
|
||||
unsigned short *ignore;
|
||||
unsigned short **forces;
|
||||
const unsigned short *normal_i2c;
|
||||
const unsigned short *probe;
|
||||
const unsigned short *ignore;
|
||||
const unsigned short * const *forces;
|
||||
};
|
||||
|
||||
/* Internal numbers to terminate lists */
|
||||
@@ -389,11 +392,8 @@ static inline int i2c_add_driver(struct i2c_driver *driver)
|
||||
extern int i2c_attach_client(struct i2c_client *);
|
||||
extern int i2c_detach_client(struct i2c_client *);
|
||||
|
||||
/* Should be used to make sure that client-struct is valid and that it
|
||||
is okay to access the i2c-client.
|
||||
returns -ENODEV if client has gone in the meantime */
|
||||
extern int i2c_use_client(struct i2c_client *);
|
||||
extern int i2c_release_client(struct i2c_client *);
|
||||
extern struct i2c_client *i2c_use_client(struct i2c_client *client);
|
||||
extern void i2c_release_client(struct i2c_client *client);
|
||||
|
||||
/* call the i2c_client->command() of all attached clients with
|
||||
* the given arguments */
|
||||
@@ -405,7 +405,7 @@ extern void i2c_clients_command(struct i2c_adapter *adap,
|
||||
* specific address (unless a 'force' matched);
|
||||
*/
|
||||
extern int i2c_probe(struct i2c_adapter *adapter,
|
||||
struct i2c_client_address_data *address_data,
|
||||
const struct i2c_client_address_data *address_data,
|
||||
int (*found_proc) (struct i2c_adapter *, int, int));
|
||||
|
||||
extern struct i2c_adapter* i2c_get_adapter(int id);
|
||||
@@ -598,104 +598,93 @@ I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
|
||||
"additionally"); \
|
||||
I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
|
||||
"scan"); \
|
||||
static struct i2c_client_address_data addr_data = { \
|
||||
const static struct i2c_client_address_data addr_data = { \
|
||||
.normal_i2c = normal_i2c, \
|
||||
.probe = probe, \
|
||||
.ignore = ignore, \
|
||||
.forces = forces, \
|
||||
}
|
||||
|
||||
#define I2C_CLIENT_FORCE_TEXT \
|
||||
"List of adapter,address pairs to boldly assume to be present"
|
||||
|
||||
/* These are the ones you want to use in your own drivers. Pick the one
|
||||
which matches the number of devices the driver differenciates between. */
|
||||
#define I2C_CLIENT_INSMOD \
|
||||
I2C_CLIENT_MODULE_PARM(force, \
|
||||
"List of adapter,address pairs to boldly assume " \
|
||||
"to be present"); \
|
||||
static unsigned short *forces[] = { \
|
||||
force, \
|
||||
NULL \
|
||||
}; \
|
||||
#define I2C_CLIENT_INSMOD \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
static const unsigned short * const forces[] = { force, NULL }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_1(chip1) \
|
||||
enum chips { any_chip, chip1 }; \
|
||||
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
|
||||
"boldly assume to be present"); \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
|
||||
static unsigned short *forces[] = { force, force_##chip1, NULL }; \
|
||||
static const unsigned short * const forces[] = { force, \
|
||||
force_##chip1, NULL }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
|
||||
enum chips { any_chip, chip1, chip2 }; \
|
||||
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
|
||||
"boldly assume to be present"); \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
|
||||
static unsigned short *forces[] = { force, force_##chip1, \
|
||||
force_##chip2, NULL }; \
|
||||
static const unsigned short * const forces[] = { force, \
|
||||
force_##chip1, force_##chip2, NULL }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
|
||||
enum chips { any_chip, chip1, chip2, chip3 }; \
|
||||
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
|
||||
"boldly assume to be present"); \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
|
||||
static unsigned short *forces[] = { force, force_##chip1, \
|
||||
force_##chip2, force_##chip3, \
|
||||
NULL }; \
|
||||
static const unsigned short * const forces[] = { force, \
|
||||
force_##chip1, force_##chip2, force_##chip3, NULL }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
|
||||
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
|
||||
"boldly assume to be present"); \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
|
||||
static unsigned short *forces[] = { force, force_##chip1, \
|
||||
force_##chip2, force_##chip3, \
|
||||
force_##chip4, NULL}; \
|
||||
static const unsigned short * const forces[] = { force, \
|
||||
force_##chip1, force_##chip2, force_##chip3, \
|
||||
force_##chip4, NULL}; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
|
||||
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
|
||||
"boldly assume to be present"); \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
|
||||
static unsigned short *forces[] = { force, force_##chip1, \
|
||||
force_##chip2, force_##chip3, \
|
||||
force_##chip4, force_##chip5, \
|
||||
NULL }; \
|
||||
static const unsigned short * const forces[] = { force, \
|
||||
force_##chip1, force_##chip2, force_##chip3, \
|
||||
force_##chip4, force_##chip5, NULL }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
|
||||
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
|
||||
"boldly assume to be present"); \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
|
||||
static unsigned short *forces[] = { force, force_##chip1, \
|
||||
force_##chip2, force_##chip3, \
|
||||
force_##chip4, force_##chip5, \
|
||||
force_##chip6, NULL }; \
|
||||
static const unsigned short * const forces[] = { force, \
|
||||
force_##chip1, force_##chip2, force_##chip3, \
|
||||
force_##chip4, force_##chip5, force_##chip6, NULL }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
|
||||
chip7 }; \
|
||||
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
|
||||
"boldly assume to be present"); \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
|
||||
@@ -703,18 +692,16 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
|
||||
static unsigned short *forces[] = { force, force_##chip1, \
|
||||
force_##chip2, force_##chip3, \
|
||||
force_##chip4, force_##chip5, \
|
||||
force_##chip6, force_##chip7, \
|
||||
NULL }; \
|
||||
static const unsigned short * const forces[] = { force, \
|
||||
force_##chip1, force_##chip2, force_##chip3, \
|
||||
force_##chip4, force_##chip5, force_##chip6, \
|
||||
force_##chip7, NULL }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
|
||||
#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
|
||||
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
|
||||
chip7, chip8 }; \
|
||||
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
|
||||
"boldly assume to be present"); \
|
||||
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
|
||||
@@ -723,11 +710,10 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
|
||||
I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
|
||||
static unsigned short *forces[] = { force, force_##chip1, \
|
||||
force_##chip2, force_##chip3, \
|
||||
force_##chip4, force_##chip5, \
|
||||
force_##chip6, force_##chip7, \
|
||||
force_##chip8, NULL }; \
|
||||
static const unsigned short * const forces[] = { force, \
|
||||
force_##chip1, force_##chip2, force_##chip3, \
|
||||
force_##chip4, force_##chip5, force_##chip6, \
|
||||
force_##chip7, force_##chip8, NULL }; \
|
||||
I2C_CLIENT_INSMOD_COMMON
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_I2C_H */
|
||||
|
156
include/linux/i2c/tps65010.h
Normal file
156
include/linux/i2c/tps65010.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/* linux/i2c/tps65010.h
|
||||
*
|
||||
* Functions to access TPS65010 power management device.
|
||||
*
|
||||
* Copyright (C) 2004 Dirk Behme <dirk.behme@de.bosch.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* 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 AUTHOR 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_I2C_TPS65010_H
|
||||
#define __LINUX_I2C_TPS65010_H
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* Registers, all 8 bits
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define TPS_CHGSTATUS 0x01
|
||||
# define TPS_CHG_USB (1 << 7)
|
||||
# define TPS_CHG_AC (1 << 6)
|
||||
# define TPS_CHG_THERM (1 << 5)
|
||||
# define TPS_CHG_TERM (1 << 4)
|
||||
# define TPS_CHG_TAPER_TMO (1 << 3)
|
||||
# define TPS_CHG_CHG_TMO (1 << 2)
|
||||
# define TPS_CHG_PRECHG_TMO (1 << 1)
|
||||
# define TPS_CHG_TEMP_ERR (1 << 0)
|
||||
#define TPS_REGSTATUS 0x02
|
||||
# define TPS_REG_ONOFF (1 << 7)
|
||||
# define TPS_REG_COVER (1 << 6)
|
||||
# define TPS_REG_UVLO (1 << 5)
|
||||
# define TPS_REG_NO_CHG (1 << 4) /* tps65013 */
|
||||
# define TPS_REG_PG_LD02 (1 << 3)
|
||||
# define TPS_REG_PG_LD01 (1 << 2)
|
||||
# define TPS_REG_PG_MAIN (1 << 1)
|
||||
# define TPS_REG_PG_CORE (1 << 0)
|
||||
#define TPS_MASK1 0x03
|
||||
#define TPS_MASK2 0x04
|
||||
#define TPS_ACKINT1 0x05
|
||||
#define TPS_ACKINT2 0x06
|
||||
#define TPS_CHGCONFIG 0x07
|
||||
# define TPS_CHARGE_POR (1 << 7) /* 65010/65012 */
|
||||
# define TPS65013_AUA (1 << 7) /* 65011/65013 */
|
||||
# define TPS_CHARGE_RESET (1 << 6)
|
||||
# define TPS_CHARGE_FAST (1 << 5)
|
||||
# define TPS_CHARGE_CURRENT (3 << 3)
|
||||
# define TPS_VBUS_500MA (1 << 2)
|
||||
# define TPS_VBUS_CHARGING (1 << 1)
|
||||
# define TPS_CHARGE_ENABLE (1 << 0)
|
||||
#define TPS_LED1_ON 0x08
|
||||
#define TPS_LED1_PER 0x09
|
||||
#define TPS_LED2_ON 0x0a
|
||||
#define TPS_LED2_PER 0x0b
|
||||
#define TPS_VDCDC1 0x0c
|
||||
# define TPS_ENABLE_LP (1 << 3)
|
||||
#define TPS_VDCDC2 0x0d
|
||||
#define TPS_VREGS1 0x0e
|
||||
# define TPS_LDO2_ENABLE (1 << 7)
|
||||
# define TPS_LDO2_OFF (1 << 6)
|
||||
# define TPS_VLDO2_3_0V (3 << 4)
|
||||
# define TPS_VLDO2_2_75V (2 << 4)
|
||||
# define TPS_VLDO2_2_5V (1 << 4)
|
||||
# define TPS_VLDO2_1_8V (0 << 4)
|
||||
# define TPS_LDO1_ENABLE (1 << 3)
|
||||
# define TPS_LDO1_OFF (1 << 2)
|
||||
# define TPS_VLDO1_3_0V (3 << 0)
|
||||
# define TPS_VLDO1_2_75V (2 << 0)
|
||||
# define TPS_VLDO1_2_5V (1 << 0)
|
||||
# define TPS_VLDO1_ADJ (0 << 0)
|
||||
#define TPS_MASK3 0x0f
|
||||
#define TPS_DEFGPIO 0x10
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* Macros used by exported functions
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define LED1 1
|
||||
#define LED2 2
|
||||
#define OFF 0
|
||||
#define ON 1
|
||||
#define BLINK 2
|
||||
#define GPIO1 1
|
||||
#define GPIO2 2
|
||||
#define GPIO3 3
|
||||
#define GPIO4 4
|
||||
#define LOW 0
|
||||
#define HIGH 1
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Draw from VBUS:
|
||||
* 0 mA -- DON'T DRAW (might supply power instead)
|
||||
* 100 mA -- usb unit load (slowest charge rate)
|
||||
* 500 mA -- usb high power (fast battery charge)
|
||||
*/
|
||||
extern int tps65010_set_vbus_draw(unsigned mA);
|
||||
|
||||
/* tps65010_set_gpio_out_value parameter:
|
||||
* gpio: GPIO1, GPIO2, GPIO3 or GPIO4
|
||||
* value: LOW or HIGH
|
||||
*/
|
||||
extern int tps65010_set_gpio_out_value(unsigned gpio, unsigned value);
|
||||
|
||||
/* tps65010_set_led parameter:
|
||||
* led: LED1 or LED2
|
||||
* mode: ON, OFF or BLINK
|
||||
*/
|
||||
extern int tps65010_set_led(unsigned led, unsigned mode);
|
||||
|
||||
/* tps65010_set_vib parameter:
|
||||
* value: ON or OFF
|
||||
*/
|
||||
extern int tps65010_set_vib(unsigned value);
|
||||
|
||||
/* tps65010_set_low_pwr parameter:
|
||||
* mode: ON or OFF
|
||||
*/
|
||||
extern int tps65010_set_low_pwr(unsigned mode);
|
||||
|
||||
/* tps65010_config_vregs1 parameter:
|
||||
* value to be written to VREGS1 register
|
||||
* Note: The complete register is written, set all bits you need
|
||||
*/
|
||||
extern int tps65010_config_vregs1(unsigned value);
|
||||
|
||||
/* tps65013_set_low_pwr parameter:
|
||||
* mode: ON or OFF
|
||||
*/
|
||||
extern int tps65013_set_low_pwr(unsigned mode);
|
||||
|
||||
#endif /* __LINUX_I2C_TPS65010_H */
|
||||
|
@@ -27,25 +27,10 @@
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/mutex.h>
|
||||
|
||||
/******************************************************************************
|
||||
* IDE driver configuration options (play with these as desired):
|
||||
*
|
||||
* REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary
|
||||
*/
|
||||
#define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */
|
||||
|
||||
#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */
|
||||
#define SUPPORT_SLOW_DATA_PORTS 1 /* 0 to reduce kernel size */
|
||||
#endif
|
||||
#ifndef SUPPORT_VLB_SYNC /* 1 to support weird 32-bit chips */
|
||||
#define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */
|
||||
#endif
|
||||
#ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */
|
||||
#define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_IRQ_NOSYNC
|
||||
#define DISABLE_IRQ_NOSYNC 0
|
||||
#if defined(CRIS) || defined(FRV)
|
||||
# define SUPPORT_VLB_SYNC 0
|
||||
#else
|
||||
# define SUPPORT_VLB_SYNC 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -55,10 +40,6 @@
|
||||
|
||||
#define IDE_NO_IRQ (-1)
|
||||
|
||||
/*
|
||||
* "No user-serviceable parts" beyond this point :)
|
||||
*****************************************************************************/
|
||||
|
||||
typedef unsigned char byte; /* used everywhere */
|
||||
|
||||
/*
|
||||
@@ -103,8 +84,6 @@ typedef unsigned char byte; /* used everywhere */
|
||||
#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
|
||||
#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
|
||||
|
||||
#define IDE_CONTROL_OFFSET_HOB (7)
|
||||
|
||||
#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET])
|
||||
#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET])
|
||||
#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET])
|
||||
@@ -128,7 +107,6 @@ typedef unsigned char byte; /* used everywhere */
|
||||
#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT)
|
||||
#define BAD_STAT (BAD_R_STAT | DRQ_STAT)
|
||||
#define DRIVE_READY (READY_STAT | SEEK_STAT)
|
||||
#define DATA_READY (DRQ_STAT)
|
||||
|
||||
#define BAD_CRC (ABRT_ERR | ICRC_ERR)
|
||||
|
||||
@@ -219,8 +197,11 @@ typedef struct hw_regs_s {
|
||||
} hw_regs_t;
|
||||
|
||||
struct hwif_s * ide_find_port(unsigned long);
|
||||
void ide_init_port_data(struct hwif_s *, unsigned int);
|
||||
void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
|
||||
|
||||
int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int,
|
||||
struct ide_drive_s;
|
||||
int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
|
||||
struct hwif_s **);
|
||||
|
||||
void ide_setup_ports( hw_regs_t *hw,
|
||||
@@ -327,46 +308,15 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw,
|
||||
typedef union {
|
||||
unsigned all : 8;
|
||||
struct {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
unsigned set_geometry : 1;
|
||||
unsigned recalibrate : 1;
|
||||
unsigned set_multmode : 1;
|
||||
unsigned set_tune : 1;
|
||||
unsigned serviced : 1;
|
||||
unsigned reserved : 3;
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
unsigned reserved : 3;
|
||||
unsigned serviced : 1;
|
||||
unsigned set_tune : 1;
|
||||
unsigned set_multmode : 1;
|
||||
unsigned recalibrate : 1;
|
||||
unsigned set_geometry : 1;
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
} b;
|
||||
} special_t;
|
||||
|
||||
/*
|
||||
* ATA DATA Register Special.
|
||||
* ATA NSECTOR Count Register().
|
||||
* ATAPI Byte Count Register.
|
||||
*/
|
||||
typedef union {
|
||||
unsigned all :16;
|
||||
struct {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
unsigned low :8; /* LSB */
|
||||
unsigned high :8; /* MSB */
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
unsigned high :8; /* MSB */
|
||||
unsigned low :8; /* LSB */
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
} b;
|
||||
} ata_nsector_t, ata_data_t, atapi_bcount_t;
|
||||
|
||||
/*
|
||||
* ATA-IDE Select Register, aka Device-Head
|
||||
*
|
||||
@@ -397,131 +347,6 @@ typedef union {
|
||||
} b;
|
||||
} select_t, ata_select_t;
|
||||
|
||||
/*
|
||||
* The ATA-IDE Status Register.
|
||||
* The ATAPI Status Register.
|
||||
*
|
||||
* check : Error occurred
|
||||
* idx : Index Error
|
||||
* corr : Correctable error occurred
|
||||
* drq : Data is request by the device
|
||||
* dsc : Disk Seek Complete : ata
|
||||
* : Media access command finished : atapi
|
||||
* df : Device Fault : ata
|
||||
* : Reserved : atapi
|
||||
* drdy : Ready, Command Mode Capable : ata
|
||||
* : Ignored for ATAPI commands : atapi
|
||||
* bsy : Disk is Busy
|
||||
* : The device has access to the command block
|
||||
*/
|
||||
typedef union {
|
||||
unsigned all :8;
|
||||
struct {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
unsigned check :1;
|
||||
unsigned idx :1;
|
||||
unsigned corr :1;
|
||||
unsigned drq :1;
|
||||
unsigned dsc :1;
|
||||
unsigned df :1;
|
||||
unsigned drdy :1;
|
||||
unsigned bsy :1;
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
unsigned bsy :1;
|
||||
unsigned drdy :1;
|
||||
unsigned df :1;
|
||||
unsigned dsc :1;
|
||||
unsigned drq :1;
|
||||
unsigned corr :1;
|
||||
unsigned idx :1;
|
||||
unsigned check :1;
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
} b;
|
||||
} ata_status_t, atapi_status_t;
|
||||
|
||||
/*
|
||||
* ATAPI Feature Register
|
||||
*
|
||||
* dma : Using DMA or PIO
|
||||
* reserved321 : Reserved
|
||||
* reserved654 : Reserved (Tag Type)
|
||||
* reserved7 : Reserved
|
||||
*/
|
||||
typedef union {
|
||||
unsigned all :8;
|
||||
struct {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
unsigned dma :1;
|
||||
unsigned reserved321 :3;
|
||||
unsigned reserved654 :3;
|
||||
unsigned reserved7 :1;
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
unsigned reserved7 :1;
|
||||
unsigned reserved654 :3;
|
||||
unsigned reserved321 :3;
|
||||
unsigned dma :1;
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
} b;
|
||||
} atapi_feature_t;
|
||||
|
||||
/*
|
||||
* ATAPI Interrupt Reason Register.
|
||||
*
|
||||
* cod : Information transferred is command (1) or data (0)
|
||||
* io : The device requests us to read (1) or write (0)
|
||||
* reserved : Reserved
|
||||
*/
|
||||
typedef union {
|
||||
unsigned all :8;
|
||||
struct {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
unsigned cod :1;
|
||||
unsigned io :1;
|
||||
unsigned reserved :6;
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
unsigned reserved :6;
|
||||
unsigned io :1;
|
||||
unsigned cod :1;
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
} b;
|
||||
} atapi_ireason_t;
|
||||
|
||||
/*
|
||||
* The ATAPI error register.
|
||||
*
|
||||
* ili : Illegal Length Indication
|
||||
* eom : End Of Media Detected
|
||||
* abrt : Aborted command - As defined by ATA
|
||||
* mcr : Media Change Requested - As defined by ATA
|
||||
* sense_key : Sense key of the last failed packet command
|
||||
*/
|
||||
typedef union {
|
||||
unsigned all :8;
|
||||
struct {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
unsigned ili :1;
|
||||
unsigned eom :1;
|
||||
unsigned abrt :1;
|
||||
unsigned mcr :1;
|
||||
unsigned sense_key :4;
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
unsigned sense_key :4;
|
||||
unsigned mcr :1;
|
||||
unsigned abrt :1;
|
||||
unsigned eom :1;
|
||||
unsigned ili :1;
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
} b;
|
||||
} atapi_error_t;
|
||||
|
||||
/*
|
||||
* Status returned from various ide_ functions
|
||||
*/
|
||||
@@ -568,7 +393,6 @@ typedef struct ide_drive_s {
|
||||
u8 state; /* retry state */
|
||||
u8 waiting_for_dma; /* dma currently in progress */
|
||||
u8 unmask; /* okay to unmask other irqs */
|
||||
u8 bswap; /* byte swap data */
|
||||
u8 noflush; /* don't attempt flushes */
|
||||
u8 dsc_overlap; /* DSC overlap */
|
||||
u8 nice1; /* give potential excess bandwidth */
|
||||
@@ -701,36 +525,29 @@ typedef struct hwif_s {
|
||||
void (*pre_reset)(ide_drive_t *);
|
||||
/* routine to reset controller after a disk reset */
|
||||
void (*resetproc)(ide_drive_t *);
|
||||
/* special interrupt handling for shared pci interrupts */
|
||||
void (*intrproc)(ide_drive_t *);
|
||||
/* special host masking for drive selection */
|
||||
void (*maskproc)(ide_drive_t *, int);
|
||||
/* check host's drive quirk list */
|
||||
int (*quirkproc)(ide_drive_t *);
|
||||
void (*quirkproc)(ide_drive_t *);
|
||||
/* driver soft-power interface */
|
||||
int (*busproc)(ide_drive_t *, int);
|
||||
#endif
|
||||
u8 (*mdma_filter)(ide_drive_t *);
|
||||
u8 (*udma_filter)(ide_drive_t *);
|
||||
|
||||
void (*fixup)(struct hwif_s *);
|
||||
|
||||
void (*ata_input_data)(ide_drive_t *, void *, u32);
|
||||
void (*ata_output_data)(ide_drive_t *, void *, u32);
|
||||
|
||||
void (*atapi_input_bytes)(ide_drive_t *, void *, u32);
|
||||
void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
|
||||
|
||||
void (*dma_host_set)(ide_drive_t *, int);
|
||||
int (*dma_setup)(ide_drive_t *);
|
||||
void (*dma_exec_cmd)(ide_drive_t *, u8);
|
||||
void (*dma_start)(ide_drive_t *);
|
||||
int (*ide_dma_end)(ide_drive_t *drive);
|
||||
int (*ide_dma_on)(ide_drive_t *drive);
|
||||
void (*dma_off_quietly)(ide_drive_t *drive);
|
||||
int (*ide_dma_test_irq)(ide_drive_t *drive);
|
||||
void (*ide_dma_clear_irq)(ide_drive_t *drive);
|
||||
void (*dma_host_on)(ide_drive_t *drive);
|
||||
void (*dma_host_off)(ide_drive_t *drive);
|
||||
void (*dma_lost_irq)(ide_drive_t *drive);
|
||||
void (*dma_timeout)(ide_drive_t *drive);
|
||||
|
||||
@@ -766,7 +583,6 @@ typedef struct hwif_s {
|
||||
int rqsize; /* max sectors per request */
|
||||
int irq; /* our irq number */
|
||||
|
||||
unsigned long dma_master; /* reference base addr dmabase */
|
||||
unsigned long dma_base; /* base addr for dma ports */
|
||||
unsigned long dma_command; /* dma command register */
|
||||
unsigned long dma_vendor1; /* dma vendor 1 register */
|
||||
@@ -806,7 +622,6 @@ typedef struct hwif_s {
|
||||
/*
|
||||
* internal ide interrupt handler type
|
||||
*/
|
||||
typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *);
|
||||
typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
|
||||
typedef int (ide_expiry_t)(ide_drive_t *);
|
||||
|
||||
@@ -1020,7 +835,8 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
|
||||
|
||||
extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
|
||||
|
||||
extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *);
|
||||
void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
|
||||
ide_expiry_t *);
|
||||
|
||||
ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
|
||||
|
||||
@@ -1054,60 +870,126 @@ extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
|
||||
|
||||
extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
|
||||
|
||||
/*
|
||||
* Issue ATA command and wait for completion.
|
||||
* Use for implementing commands in kernel
|
||||
*
|
||||
* (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf)
|
||||
*/
|
||||
extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *);
|
||||
enum {
|
||||
IDE_TFLAG_LBA48 = (1 << 0),
|
||||
IDE_TFLAG_NO_SELECT_MASK = (1 << 1),
|
||||
IDE_TFLAG_FLAGGED = (1 << 2),
|
||||
IDE_TFLAG_OUT_DATA = (1 << 3),
|
||||
IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
|
||||
IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
|
||||
IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
|
||||
IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
|
||||
IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
|
||||
IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
|
||||
IDE_TFLAG_OUT_HOB_NSECT |
|
||||
IDE_TFLAG_OUT_HOB_LBAL |
|
||||
IDE_TFLAG_OUT_HOB_LBAM |
|
||||
IDE_TFLAG_OUT_HOB_LBAH,
|
||||
IDE_TFLAG_OUT_FEATURE = (1 << 9),
|
||||
IDE_TFLAG_OUT_NSECT = (1 << 10),
|
||||
IDE_TFLAG_OUT_LBAL = (1 << 11),
|
||||
IDE_TFLAG_OUT_LBAM = (1 << 12),
|
||||
IDE_TFLAG_OUT_LBAH = (1 << 13),
|
||||
IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
|
||||
IDE_TFLAG_OUT_NSECT |
|
||||
IDE_TFLAG_OUT_LBAL |
|
||||
IDE_TFLAG_OUT_LBAM |
|
||||
IDE_TFLAG_OUT_LBAH,
|
||||
IDE_TFLAG_OUT_DEVICE = (1 << 14),
|
||||
IDE_TFLAG_WRITE = (1 << 15),
|
||||
IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
|
||||
IDE_TFLAG_IN_DATA = (1 << 17),
|
||||
IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
|
||||
IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
|
||||
IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
|
||||
IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
|
||||
IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
|
||||
IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
|
||||
IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
|
||||
IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
|
||||
IDE_TFLAG_IN_HOB_LBAM |
|
||||
IDE_TFLAG_IN_HOB_LBAH,
|
||||
IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
|
||||
IDE_TFLAG_IN_HOB_NSECT |
|
||||
IDE_TFLAG_IN_HOB_LBA,
|
||||
IDE_TFLAG_IN_NSECT = (1 << 25),
|
||||
IDE_TFLAG_IN_LBAL = (1 << 26),
|
||||
IDE_TFLAG_IN_LBAM = (1 << 27),
|
||||
IDE_TFLAG_IN_LBAH = (1 << 28),
|
||||
IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
|
||||
IDE_TFLAG_IN_LBAM |
|
||||
IDE_TFLAG_IN_LBAH,
|
||||
IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
|
||||
IDE_TFLAG_IN_LBA,
|
||||
IDE_TFLAG_IN_DEVICE = (1 << 29),
|
||||
IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
|
||||
IDE_TFLAG_IN_HOB,
|
||||
IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
|
||||
IDE_TFLAG_IN_TF,
|
||||
IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
|
||||
IDE_TFLAG_IN_DEVICE,
|
||||
/* force 16-bit I/O operations */
|
||||
IDE_TFLAG_IO_16BIT = (1 << 30),
|
||||
};
|
||||
|
||||
struct ide_taskfile {
|
||||
u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
|
||||
|
||||
u8 hob_feature; /* 1-5: additional data to support LBA48 */
|
||||
u8 hob_nsect;
|
||||
u8 hob_lbal;
|
||||
u8 hob_lbam;
|
||||
u8 hob_lbah;
|
||||
|
||||
u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
|
||||
|
||||
union { /* 7: */
|
||||
u8 error; /* read: error */
|
||||
u8 feature; /* write: feature */
|
||||
};
|
||||
|
||||
u8 nsect; /* 8: number of sectors */
|
||||
u8 lbal; /* 9: LBA low */
|
||||
u8 lbam; /* 10: LBA mid */
|
||||
u8 lbah; /* 11: LBA high */
|
||||
|
||||
u8 device; /* 12: device select */
|
||||
|
||||
union { /* 13: */
|
||||
u8 status; /* read: status */
|
||||
u8 command; /* write: command */
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct ide_task_s {
|
||||
/*
|
||||
* struct hd_drive_task_hdr tf;
|
||||
* task_struct_t tf;
|
||||
* struct hd_drive_hob_hdr hobf;
|
||||
* hob_struct_t hobf;
|
||||
*/
|
||||
task_ioreg_t tfRegister[8];
|
||||
task_ioreg_t hobRegister[8];
|
||||
ide_reg_valid_t tf_out_flags;
|
||||
ide_reg_valid_t tf_in_flags;
|
||||
union {
|
||||
struct ide_taskfile tf;
|
||||
u8 tf_array[14];
|
||||
};
|
||||
u32 tf_flags;
|
||||
int data_phase;
|
||||
int command_type;
|
||||
ide_pre_handler_t *prehandler;
|
||||
ide_handler_t *handler;
|
||||
struct request *rq; /* copy of request */
|
||||
void *special; /* valid_t generally */
|
||||
} ide_task_t;
|
||||
|
||||
extern u32 ide_read_24(ide_drive_t *);
|
||||
void ide_tf_load(ide_drive_t *, ide_task_t *);
|
||||
void ide_tf_read(ide_drive_t *, ide_task_t *);
|
||||
|
||||
extern void SELECT_DRIVE(ide_drive_t *);
|
||||
extern void SELECT_INTERRUPT(ide_drive_t *);
|
||||
extern void SELECT_MASK(ide_drive_t *, int);
|
||||
extern void QUIRK_LIST(ide_drive_t *);
|
||||
|
||||
extern int drive_is_ready(ide_drive_t *);
|
||||
|
||||
/*
|
||||
* taskfile io for disks for now...and builds request from ide_ioctl
|
||||
*/
|
||||
extern ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
|
||||
void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
|
||||
|
||||
/*
|
||||
* Special Flagged Register Validation Caller
|
||||
*/
|
||||
extern ide_startstop_t flagged_taskfile(ide_drive_t *, ide_task_t *);
|
||||
ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
|
||||
|
||||
extern ide_startstop_t set_multmode_intr(ide_drive_t *);
|
||||
extern ide_startstop_t set_geometry_intr(ide_drive_t *);
|
||||
extern ide_startstop_t recal_intr(ide_drive_t *);
|
||||
extern ide_startstop_t task_no_data_intr(ide_drive_t *);
|
||||
extern ide_startstop_t task_in_intr(ide_drive_t *);
|
||||
extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
|
||||
void task_end_request(ide_drive_t *, struct request *, u8);
|
||||
|
||||
extern int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *);
|
||||
u8 wait_drive_not_busy(ide_drive_t *);
|
||||
|
||||
int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16);
|
||||
int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
|
||||
|
||||
int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
|
||||
int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
|
||||
@@ -1133,10 +1015,9 @@ extern void do_ide_request(struct request_queue *);
|
||||
|
||||
void ide_init_disk(struct gendisk *, ide_drive_t *);
|
||||
|
||||
extern int ideprobe_init(void);
|
||||
|
||||
#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
|
||||
extern void ide_scan_pcibus(int scan_direction) __init;
|
||||
extern int ide_scan_direction;
|
||||
int __init ide_scan_pcibus(void);
|
||||
extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
|
||||
#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
|
||||
#else
|
||||
@@ -1212,6 +1093,9 @@ enum {
|
||||
IDE_HFLAG_IO_32BIT = (1 << 24),
|
||||
/* unmask IRQs */
|
||||
IDE_HFLAG_UNMASK_IRQS = (1 << 25),
|
||||
IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
|
||||
/* host is CY82C693 */
|
||||
IDE_HFLAG_CY82C693 = (1 << 27),
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_OFFBOARD
|
||||
@@ -1226,10 +1110,9 @@ struct ide_port_info {
|
||||
void (*init_iops)(ide_hwif_t *);
|
||||
void (*init_hwif)(ide_hwif_t *);
|
||||
void (*init_dma)(ide_hwif_t *, unsigned long);
|
||||
void (*fixup)(ide_hwif_t *);
|
||||
ide_pci_enablebit_t enablebits[2];
|
||||
hwif_chipset_t chipset;
|
||||
unsigned int extra;
|
||||
u8 extra;
|
||||
u32 host_flags;
|
||||
u8 pio_mask;
|
||||
u8 swdma_mask;
|
||||
@@ -1264,7 +1147,9 @@ static inline u8 ide_max_dma_mode(ide_drive_t *drive)
|
||||
return ide_find_dma_mode(drive, XFER_UDMA_6);
|
||||
}
|
||||
|
||||
void ide_dma_off_quietly(ide_drive_t *);
|
||||
void ide_dma_off(ide_drive_t *);
|
||||
void ide_dma_on(ide_drive_t *);
|
||||
int ide_set_dma(ide_drive_t *);
|
||||
ide_startstop_t ide_dma_intr(ide_drive_t *);
|
||||
|
||||
@@ -1275,10 +1160,7 @@ extern void ide_destroy_dmatable(ide_drive_t *);
|
||||
extern int ide_release_dma(ide_hwif_t *);
|
||||
extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int);
|
||||
|
||||
void ide_dma_host_off(ide_drive_t *);
|
||||
void ide_dma_off_quietly(ide_drive_t *);
|
||||
void ide_dma_host_on(ide_drive_t *);
|
||||
extern int __ide_dma_on(ide_drive_t *);
|
||||
void ide_dma_host_set(ide_drive_t *, int);
|
||||
extern int ide_dma_setup(ide_drive_t *);
|
||||
extern void ide_dma_start(ide_drive_t *);
|
||||
extern int __ide_dma_end(ide_drive_t *);
|
||||
@@ -1290,7 +1172,9 @@ extern void ide_dma_timeout(ide_drive_t *);
|
||||
static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
|
||||
static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
|
||||
static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
|
||||
static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }
|
||||
static inline void ide_dma_off(ide_drive_t *drive) { ; }
|
||||
static inline void ide_dma_on(ide_drive_t *drive) { ; }
|
||||
static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
|
||||
static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
|
||||
#endif /* CONFIG_BLK_DEV_IDEDMA */
|
||||
@@ -1320,8 +1204,9 @@ extern void ide_unregister (unsigned int index);
|
||||
void ide_register_region(struct gendisk *);
|
||||
void ide_unregister_region(struct gendisk *);
|
||||
|
||||
void ide_undecoded_slave(ide_hwif_t *);
|
||||
void ide_undecoded_slave(ide_drive_t *);
|
||||
|
||||
int ide_device_add_all(u8 *idx);
|
||||
int ide_device_add(u8 idx[4]);
|
||||
|
||||
static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
|
||||
@@ -1356,6 +1241,7 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
u64 ide_get_lba_addr(struct ide_taskfile *, int);
|
||||
u8 ide_dump_status(ide_drive_t *, const char *, u8);
|
||||
|
||||
typedef struct ide_pio_timings_s {
|
||||
@@ -1418,4 +1304,9 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
|
||||
return &hwif->drives[(drive->dn ^ 1) & 1];
|
||||
}
|
||||
|
||||
static inline void ide_set_irq(ide_drive_t *drive, int on)
|
||||
{
|
||||
drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG);
|
||||
}
|
||||
|
||||
#endif /* _IDE_H */
|
||||
|
@@ -54,6 +54,8 @@
|
||||
#define IEEE80211_STYPE_ACTION 0x00D0
|
||||
|
||||
/* control */
|
||||
#define IEEE80211_STYPE_BACK_REQ 0x0080
|
||||
#define IEEE80211_STYPE_BACK 0x0090
|
||||
#define IEEE80211_STYPE_PSPOLL 0x00A0
|
||||
#define IEEE80211_STYPE_RTS 0x00B0
|
||||
#define IEEE80211_STYPE_CTS 0x00C0
|
||||
@@ -81,18 +83,18 @@
|
||||
|
||||
|
||||
/* miscellaneous IEEE 802.11 constants */
|
||||
#define IEEE80211_MAX_FRAG_THRESHOLD 2346
|
||||
#define IEEE80211_MAX_RTS_THRESHOLD 2347
|
||||
#define IEEE80211_MAX_FRAG_THRESHOLD 2352
|
||||
#define IEEE80211_MAX_RTS_THRESHOLD 2353
|
||||
#define IEEE80211_MAX_AID 2007
|
||||
#define IEEE80211_MAX_TIM_LEN 251
|
||||
#define IEEE80211_MAX_DATA_LEN 2304
|
||||
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
|
||||
6.2.1.1.2.
|
||||
|
||||
The figure in section 7.1.2 suggests a body size of up to 2312
|
||||
bytes is allowed, which is a bit confusing, I suspect this
|
||||
represents the 2304 bytes of real data, plus a possible 8 bytes of
|
||||
WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
|
||||
802.11e clarifies the figure in section 7.1.2. The frame body is
|
||||
up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
|
||||
#define IEEE80211_MAX_DATA_LEN 2304
|
||||
/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
|
||||
#define IEEE80211_MAX_FRAME_LEN 2352
|
||||
|
||||
#define IEEE80211_MAX_SSID_LEN 32
|
||||
|
||||
@@ -185,6 +187,25 @@ struct ieee80211_mgmt {
|
||||
u8 new_chan;
|
||||
u8 switch_count;
|
||||
} __attribute__((packed)) chan_switch;
|
||||
struct{
|
||||
u8 action_code;
|
||||
u8 dialog_token;
|
||||
__le16 capab;
|
||||
__le16 timeout;
|
||||
__le16 start_seq_num;
|
||||
} __attribute__((packed)) addba_req;
|
||||
struct{
|
||||
u8 action_code;
|
||||
u8 dialog_token;
|
||||
__le16 status;
|
||||
__le16 capab;
|
||||
__le16 timeout;
|
||||
} __attribute__((packed)) addba_resp;
|
||||
struct{
|
||||
u8 action_code;
|
||||
__le16 params;
|
||||
__le16 reason_code;
|
||||
} __attribute__((packed)) delba;
|
||||
} u;
|
||||
} __attribute__ ((packed)) action;
|
||||
} u;
|
||||
@@ -205,6 +226,66 @@ struct ieee80211_cts {
|
||||
u8 ra[6];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/**
|
||||
* struct ieee80211_bar - HT Block Ack Request
|
||||
*
|
||||
* This structure refers to "HT BlockAckReq" as
|
||||
* described in 802.11n draft section 7.2.1.7.1
|
||||
*/
|
||||
struct ieee80211_bar {
|
||||
__le16 frame_control;
|
||||
__le16 duration;
|
||||
__u8 ra[6];
|
||||
__u8 ta[6];
|
||||
__le16 control;
|
||||
__le16 start_seq_num;
|
||||
} __attribute__((packed));
|
||||
|
||||
/**
|
||||
* struct ieee80211_ht_cap - HT capabilities
|
||||
*
|
||||
* This structure refers to "HT capabilities element" as
|
||||
* described in 802.11n draft section 7.3.2.52
|
||||
*/
|
||||
struct ieee80211_ht_cap {
|
||||
__le16 cap_info;
|
||||
u8 ampdu_params_info;
|
||||
u8 supp_mcs_set[16];
|
||||
__le16 extended_ht_cap_info;
|
||||
__le32 tx_BF_cap_info;
|
||||
u8 antenna_selection_info;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/**
|
||||
* struct ieee80211_ht_cap - HT additional information
|
||||
*
|
||||
* This structure refers to "HT information element" as
|
||||
* described in 802.11n draft section 7.3.2.53
|
||||
*/
|
||||
struct ieee80211_ht_addt_info {
|
||||
u8 control_chan;
|
||||
u8 ht_param;
|
||||
__le16 operation_mode;
|
||||
__le16 stbc_param;
|
||||
u8 basic_set[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* 802.11n HT capabilities masks */
|
||||
#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
|
||||
#define IEEE80211_HT_CAP_MIMO_PS 0x000C
|
||||
#define IEEE80211_HT_CAP_GRN_FLD 0x0010
|
||||
#define IEEE80211_HT_CAP_SGI_20 0x0020
|
||||
#define IEEE80211_HT_CAP_SGI_40 0x0040
|
||||
#define IEEE80211_HT_CAP_DELAY_BA 0x0400
|
||||
#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
|
||||
#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
|
||||
#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
|
||||
/* 802.11n HT IE masks */
|
||||
#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
|
||||
#define IEEE80211_HT_IE_CHA_WIDTH 0x04
|
||||
#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
|
||||
#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
|
||||
#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
|
||||
|
||||
/* Authentication algorithms */
|
||||
#define WLAN_AUTH_OPEN 0
|
||||
@@ -271,6 +352,18 @@ enum ieee80211_statuscode {
|
||||
WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
|
||||
WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
|
||||
WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
|
||||
/* 802.11e */
|
||||
WLAN_STATUS_UNSPECIFIED_QOS = 32,
|
||||
WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
|
||||
WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
|
||||
WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
|
||||
WLAN_STATUS_REQUEST_DECLINED = 37,
|
||||
WLAN_STATUS_INVALID_QOS_PARAM = 38,
|
||||
WLAN_STATUS_CHANGE_TSPEC = 39,
|
||||
WLAN_STATUS_WAIT_TS_DELAY = 47,
|
||||
WLAN_STATUS_NO_DIRECT_LINK = 48,
|
||||
WLAN_STATUS_STA_NOT_PRESENT = 49,
|
||||
WLAN_STATUS_STA_NOT_QSTA = 50,
|
||||
};
|
||||
|
||||
|
||||
@@ -301,6 +394,16 @@ enum ieee80211_reasoncode {
|
||||
WLAN_REASON_INVALID_RSN_IE_CAP = 22,
|
||||
WLAN_REASON_IEEE8021X_FAILED = 23,
|
||||
WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
|
||||
/* 802.11e */
|
||||
WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
|
||||
WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
|
||||
WLAN_REASON_DISASSOC_LOW_ACK = 34,
|
||||
WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
|
||||
WLAN_REASON_QSTA_LEAVE_QBSS = 36,
|
||||
WLAN_REASON_QSTA_NOT_USE = 37,
|
||||
WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
|
||||
WLAN_REASON_QSTA_TIMEOUT = 39,
|
||||
WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
|
||||
};
|
||||
|
||||
|
||||
@@ -319,6 +422,15 @@ enum ieee80211_eid {
|
||||
WLAN_EID_HP_PARAMS = 8,
|
||||
WLAN_EID_HP_TABLE = 9,
|
||||
WLAN_EID_REQUEST = 10,
|
||||
/* 802.11e */
|
||||
WLAN_EID_QBSS_LOAD = 11,
|
||||
WLAN_EID_EDCA_PARAM_SET = 12,
|
||||
WLAN_EID_TSPEC = 13,
|
||||
WLAN_EID_TCLAS = 14,
|
||||
WLAN_EID_SCHEDULE = 15,
|
||||
WLAN_EID_TS_DELAY = 43,
|
||||
WLAN_EID_TCLAS_PROCESSING = 44,
|
||||
WLAN_EID_QOS_CAPA = 46,
|
||||
/* 802.11h */
|
||||
WLAN_EID_PWR_CONSTRAINT = 32,
|
||||
WLAN_EID_PWR_CAPABILITY = 33,
|
||||
@@ -333,6 +445,9 @@ enum ieee80211_eid {
|
||||
/* 802.11g */
|
||||
WLAN_EID_ERP_INFO = 42,
|
||||
WLAN_EID_EXT_SUPP_RATES = 50,
|
||||
/* 802.11n */
|
||||
WLAN_EID_HT_CAPABILITY = 45,
|
||||
WLAN_EID_HT_EXTRA_INFO = 61,
|
||||
/* 802.11i */
|
||||
WLAN_EID_RSN = 48,
|
||||
WLAN_EID_WPA = 221,
|
||||
@@ -341,6 +456,32 @@ enum ieee80211_eid {
|
||||
WLAN_EID_QOS_PARAMETER = 222
|
||||
};
|
||||
|
||||
/* Action category code */
|
||||
enum ieee80211_category {
|
||||
WLAN_CATEGORY_SPECTRUM_MGMT = 0,
|
||||
WLAN_CATEGORY_QOS = 1,
|
||||
WLAN_CATEGORY_DLS = 2,
|
||||
WLAN_CATEGORY_BACK = 3,
|
||||
WLAN_CATEGORY_WMM = 17,
|
||||
};
|
||||
|
||||
/* BACK action code */
|
||||
enum ieee80211_back_actioncode {
|
||||
WLAN_ACTION_ADDBA_REQ = 0,
|
||||
WLAN_ACTION_ADDBA_RESP = 1,
|
||||
WLAN_ACTION_DELBA = 2,
|
||||
};
|
||||
|
||||
/* BACK (block-ack) parties */
|
||||
enum ieee80211_back_parties {
|
||||
WLAN_BACK_RECIPIENT = 0,
|
||||
WLAN_BACK_INITIATOR = 1,
|
||||
WLAN_BACK_TIMER = 2,
|
||||
};
|
||||
|
||||
/* A-MSDU 802.11n */
|
||||
#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
|
||||
|
||||
/* cipher suite selectors */
|
||||
#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
|
||||
#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
|
||||
|
@@ -50,7 +50,9 @@
|
||||
#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
|
||||
#define IFF_DORMANT 0x20000 /* driver signals dormant */
|
||||
|
||||
#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|\
|
||||
#define IFF_ECHO 0x40000 /* echo sent packets */
|
||||
|
||||
#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
|
||||
IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
|
||||
|
||||
/* Private (from user) interface flags (netdevice->priv_flags). */
|
||||
@@ -61,6 +63,7 @@
|
||||
#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
|
||||
#define IFF_BONDING 0x20 /* bonding master or slave */
|
||||
#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
|
||||
#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
|
||||
|
||||
#define IF_GET_IFACE 0x0001 /* for querying only */
|
||||
#define IF_GET_PROTO 0x0002
|
||||
|
32
include/linux/if_addrlabel.h
Normal file
32
include/linux/if_addrlabel.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* if_addrlabel.h - netlink interface for address labels
|
||||
*
|
||||
* Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved.
|
||||
*
|
||||
* Authors:
|
||||
* YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org>
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_IF_ADDRLABEL_H
|
||||
#define __LINUX_IF_ADDRLABEL_H
|
||||
|
||||
struct ifaddrlblmsg
|
||||
{
|
||||
__u8 ifal_family; /* Address family */
|
||||
__u8 __ifal_reserved; /* Reserved */
|
||||
__u8 ifal_prefixlen; /* Prefix length */
|
||||
__u8 ifal_flags; /* Flags */
|
||||
__u32 ifal_index; /* Link index */
|
||||
__u32 ifal_seq; /* sequence number */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
IFAL_ADDRESS = 1,
|
||||
IFAL_LABEL = 2,
|
||||
__IFAL_MAX
|
||||
};
|
||||
|
||||
#define IFAL_MAX (__IFAL_MAX - 1)
|
||||
|
||||
#endif
|
@@ -52,6 +52,7 @@
|
||||
#define ARPHRD_ROSE 270
|
||||
#define ARPHRD_X25 271 /* CCITT X.25 */
|
||||
#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */
|
||||
#define ARPHRD_CAN 280 /* Controller Area Network */
|
||||
#define ARPHRD_PPP 512
|
||||
#define ARPHRD_CISCO 513 /* Cisco HDLC */
|
||||
#define ARPHRD_HDLC ARPHRD_CISCO
|
||||
|
@@ -90,6 +90,7 @@
|
||||
#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
|
||||
#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
|
||||
#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
|
||||
#define ETH_P_CAN 0x000C /* Controller Area Network */
|
||||
#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
|
||||
#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
|
||||
#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
|
||||
@@ -123,12 +124,15 @@ int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
|
||||
extern struct ctl_table ether_table[];
|
||||
#endif
|
||||
|
||||
extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
|
||||
|
||||
/*
|
||||
* Display a 6 byte device address (MAC) in a readable format.
|
||||
*/
|
||||
extern char *print_mac(char *buf, const unsigned char *addr);
|
||||
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
extern char *print_mac(char *buf, const u8 *addr);
|
||||
#define DECLARE_MAC_BUF(var) char var[18] __maybe_unused
|
||||
#define MAC_BUF_SIZE 18
|
||||
#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -137,7 +137,7 @@ struct frhdr
|
||||
|
||||
unsigned char NLPID;
|
||||
unsigned char OUI[3];
|
||||
unsigned short PID;
|
||||
__be16 PID;
|
||||
|
||||
#define IP_NLPID pad
|
||||
} __attribute__((packed));
|
||||
|
@@ -1,51 +0,0 @@
|
||||
#ifndef __LINUX_SHAPER_H
|
||||
#define __LINUX_SHAPER_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define SHAPER_QLEN 10
|
||||
/*
|
||||
* This is a bit speed dependent (read it shouldn't be a constant!)
|
||||
*
|
||||
* 5 is about right for 28.8 upwards. Below that double for every
|
||||
* halving of speed or so. - ie about 20 for 9600 baud.
|
||||
*/
|
||||
#define SHAPER_LATENCY (5*HZ)
|
||||
#define SHAPER_MAXSLIP 2
|
||||
#define SHAPER_BURST (HZ/50) /* Good for >128K then */
|
||||
|
||||
struct shaper
|
||||
{
|
||||
struct sk_buff_head sendq;
|
||||
__u32 bytespertick;
|
||||
__u32 bitspersec;
|
||||
__u32 shapelatency;
|
||||
__u32 shapeclock;
|
||||
unsigned long recovery; /* Time we can next clock a packet out on
|
||||
an empty queue */
|
||||
spinlock_t lock;
|
||||
struct net_device *dev;
|
||||
struct net_device_stats* (*get_stats)(struct net_device *dev);
|
||||
struct timer_list timer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#define SHAPER_SET_DEV 0x0001
|
||||
#define SHAPER_SET_SPEED 0x0002
|
||||
#define SHAPER_GET_DEV 0x0003
|
||||
#define SHAPER_GET_SPEED 0x0004
|
||||
|
||||
struct shaperconf
|
||||
{
|
||||
__u16 ss_cmd;
|
||||
union
|
||||
{
|
||||
char ssu_name[14];
|
||||
__u32 ssu_speed;
|
||||
} ss_u;
|
||||
#define ss_speed ss_u.ssu_speed
|
||||
#define ss_name ss_u.ssu_name
|
||||
};
|
||||
|
||||
#endif
|
@@ -49,9 +49,6 @@ static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct trh_hdr *)skb_mac_header(skb);
|
||||
}
|
||||
#ifdef CONFIG_SYSCTL
|
||||
extern struct ctl_table tr_table[];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This is an Token-Ring LLC structure */
|
||||
|
@@ -21,6 +21,8 @@
|
||||
/* Uncomment to enable debugging */
|
||||
/* #define TUN_DEBUG 1 */
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#ifdef TUN_DEBUG
|
||||
@@ -88,7 +90,7 @@ struct tun_struct {
|
||||
|
||||
struct tun_pi {
|
||||
unsigned short flags;
|
||||
unsigned short proto;
|
||||
__be16 proto;
|
||||
};
|
||||
#define TUN_PKT_STRIP 0x0001
|
||||
|
||||
|
@@ -17,6 +17,9 @@
|
||||
#define GRE_FLAGS __constant_htons(0x00F8)
|
||||
#define GRE_VERSION __constant_htons(0x0007)
|
||||
|
||||
/* i_flags values for SIT mode */
|
||||
#define SIT_ISATAP 0x0001
|
||||
|
||||
struct ip_tunnel_parm
|
||||
{
|
||||
char name[IFNAMSIZ];
|
||||
|
@@ -16,11 +16,6 @@
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/* externally defined structs */
|
||||
struct vlan_group;
|
||||
struct net_device;
|
||||
struct packet_type;
|
||||
struct vlan_collection;
|
||||
struct vlan_dev_info;
|
||||
struct hlist_node;
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
@@ -39,12 +34,30 @@ struct hlist_node;
|
||||
#define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */
|
||||
#define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */
|
||||
|
||||
/*
|
||||
* struct vlan_hdr - vlan header
|
||||
* @h_vlan_TCI: priority and VLAN ID
|
||||
* @h_vlan_encapsulated_proto: packet type ID or len
|
||||
*/
|
||||
struct vlan_hdr {
|
||||
__be16 h_vlan_TCI;
|
||||
__be16 h_vlan_encapsulated_proto;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
|
||||
* @h_dest: destination ethernet address
|
||||
* @h_source: source ethernet address
|
||||
* @h_vlan_proto: ethernet protocol (always 0x8100)
|
||||
* @h_vlan_TCI: priority and VLAN ID
|
||||
* @h_vlan_encapsulated_proto: packet type ID or len
|
||||
*/
|
||||
struct vlan_ethhdr {
|
||||
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
|
||||
unsigned char h_source[ETH_ALEN]; /* source ether addr */
|
||||
__be16 h_vlan_proto; /* Should always be 0x8100 */
|
||||
__be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */
|
||||
__be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */
|
||||
unsigned char h_dest[ETH_ALEN];
|
||||
unsigned char h_source[ETH_ALEN];
|
||||
__be16 h_vlan_proto;
|
||||
__be16 h_vlan_TCI;
|
||||
__be16 h_vlan_encapsulated_proto;
|
||||
};
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
@@ -54,18 +67,11 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
|
||||
return (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
}
|
||||
|
||||
struct vlan_hdr {
|
||||
__be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */
|
||||
__be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */
|
||||
};
|
||||
|
||||
#define VLAN_VID_MASK 0xfff
|
||||
|
||||
/* found in socket.c */
|
||||
extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
|
||||
|
||||
#define VLAN_NAME "vlan"
|
||||
|
||||
/* if this changes, algorithm will have to be reworked because this
|
||||
* depends on completely exhausting the VLAN identifier space. Thus
|
||||
* it gives constant time look-up, but in many cases it wastes memory.
|
||||
@@ -76,19 +82,22 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
|
||||
|
||||
struct vlan_group {
|
||||
int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */
|
||||
unsigned int nr_vlans;
|
||||
struct hlist_node hlist; /* linked list */
|
||||
struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
|
||||
static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, int vlan_id)
|
||||
static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
|
||||
unsigned int vlan_id)
|
||||
{
|
||||
struct net_device **array;
|
||||
array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
|
||||
return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN];
|
||||
}
|
||||
|
||||
static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id,
|
||||
static inline void vlan_group_set_device(struct vlan_group *vg,
|
||||
unsigned int vlan_id,
|
||||
struct net_device *dev)
|
||||
{
|
||||
struct net_device **array;
|
||||
@@ -132,22 +141,18 @@ struct vlan_dev_info {
|
||||
struct proc_dir_entry *dent; /* Holds the proc data */
|
||||
unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */
|
||||
unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */
|
||||
struct net_device_stats dev_stats; /* Device stats (rx-bytes, tx-pkts, etc...) */
|
||||
};
|
||||
|
||||
#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv))
|
||||
|
||||
/* inline functions */
|
||||
|
||||
static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
|
||||
static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev)
|
||||
{
|
||||
return &(VLAN_DEV_INFO(dev)->dev_stats);
|
||||
return netdev_priv(dev);
|
||||
}
|
||||
|
||||
/* inline functions */
|
||||
static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
|
||||
unsigned short vlan_tag)
|
||||
{
|
||||
struct vlan_dev_info *vip = VLAN_DEV_INFO(dev);
|
||||
struct vlan_dev_info *vip = vlan_dev_info(dev);
|
||||
|
||||
return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7];
|
||||
}
|
||||
@@ -188,7 +193,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
|
||||
|
||||
skb->dev->last_rx = jiffies;
|
||||
|
||||
stats = vlan_dev_get_stats(skb->dev);
|
||||
stats = &skb->dev->stats;
|
||||
stats->rx_packets++;
|
||||
stats->rx_bytes += skb->len;
|
||||
|
||||
@@ -266,12 +271,12 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
|
||||
memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
|
||||
|
||||
/* first, the ethernet type */
|
||||
veth->h_vlan_proto = __constant_htons(ETH_P_8021Q);
|
||||
veth->h_vlan_proto = htons(ETH_P_8021Q);
|
||||
|
||||
/* now, the tag */
|
||||
veth->h_vlan_TCI = htons(tag);
|
||||
|
||||
skb->protocol = __constant_htons(ETH_P_8021Q);
|
||||
skb->protocol = htons(ETH_P_8021Q);
|
||||
skb->mac_header -= VLAN_HLEN;
|
||||
skb->network_header -= VLAN_HLEN;
|
||||
|
||||
@@ -326,7 +331,7 @@ static inline int __vlan_get_tag(struct sk_buff *skb, unsigned short *tag)
|
||||
{
|
||||
struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
|
||||
|
||||
if (veth->h_vlan_proto != __constant_htons(ETH_P_8021Q)) {
|
||||
if (veth->h_vlan_proto != htons(ETH_P_8021Q)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@@ -246,13 +246,69 @@ struct sockaddr_in {
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/* Some random defines to make it easier in the kernel.. */
|
||||
#define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000))
|
||||
#define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000))
|
||||
#define BADCLASS(x) (((x) & htonl(0xf0000000)) == htonl(0xf0000000))
|
||||
#define ZERONET(x) (((x) & htonl(0xff000000)) == htonl(0x00000000))
|
||||
#define LOCAL_MCAST(x) (((x) & htonl(0xFFFFFF00)) == htonl(0xE0000000))
|
||||
|
||||
static inline bool ipv4_is_loopback(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xff000000)) == htonl(0x7f000000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_multicast(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_local_multicast(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffffff00)) == htonl(0xe0000000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_lbcast(__be32 addr)
|
||||
{
|
||||
/* limited broadcast */
|
||||
return addr == INADDR_BROADCAST;
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_zeronet(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xff000000)) == htonl(0x00000000);
|
||||
}
|
||||
|
||||
/* Special-Use IPv4 Addresses (RFC3330) */
|
||||
|
||||
static inline bool ipv4_is_private_10(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xff000000)) == htonl(0x0a000000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_private_172(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xfff00000)) == htonl(0xac100000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_private_192(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffff0000)) == htonl(0xc0a80000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_linklocal_169(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffff0000)) == htonl(0xa9fe0000);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_anycast_6to4(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffffff00)) == htonl(0xc0586300);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_test_192(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xffffff00)) == htonl(0xc0000200);
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_test_198(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xfffe0000)) == htonl(0xc6120000);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_IN_H */
|
||||
|
@@ -44,7 +44,8 @@ struct in_device
|
||||
};
|
||||
|
||||
#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1])
|
||||
#define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr)
|
||||
#define IPV4_DEVCONF_ALL(net, attr) \
|
||||
IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr)
|
||||
|
||||
static inline int ipv4_devconf_get(struct in_device *in_dev, int index)
|
||||
{
|
||||
@@ -71,16 +72,17 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
|
||||
ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
|
||||
|
||||
#define IN_DEV_ANDCONF(in_dev, attr) \
|
||||
(IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr))
|
||||
(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \
|
||||
IN_DEV_CONF_GET((in_dev), attr))
|
||||
#define IN_DEV_ORCONF(in_dev, attr) \
|
||||
(IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr))
|
||||
(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \
|
||||
IN_DEV_CONF_GET((in_dev), attr))
|
||||
#define IN_DEV_MAXCONF(in_dev, attr) \
|
||||
(max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr)))
|
||||
(max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \
|
||||
IN_DEV_CONF_GET((in_dev), attr)))
|
||||
|
||||
#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
|
||||
#define IN_DEV_MFORWARD(in_dev) (IPV4_DEVCONF_ALL(MC_FORWARDING) && \
|
||||
IPV4_DEVCONF((in_dev)->cnf, \
|
||||
MC_FORWARDING))
|
||||
#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
|
||||
#define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER)
|
||||
#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \
|
||||
ACCEPT_SOURCE_ROUTE)
|
||||
@@ -127,15 +129,14 @@ struct in_ifaddr
|
||||
extern int register_inetaddr_notifier(struct notifier_block *nb);
|
||||
extern int unregister_inetaddr_notifier(struct notifier_block *nb);
|
||||
|
||||
extern struct net_device *ip_dev_find(__be32 addr);
|
||||
extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
|
||||
extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
|
||||
extern int devinet_ioctl(unsigned int cmd, void __user *);
|
||||
extern void devinet_init(void);
|
||||
extern struct in_device *inetdev_by_index(int);
|
||||
extern struct in_device *inetdev_by_index(struct net *, int);
|
||||
extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
|
||||
extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
|
||||
extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope);
|
||||
extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
|
||||
extern void inet_forward_change(void);
|
||||
|
||||
static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
|
||||
{
|
||||
|
@@ -40,10 +40,10 @@
|
||||
|
||||
/* These are for everybody (although not all archs will actually
|
||||
discard it in modules) */
|
||||
#define __init __attribute__ ((__section__ (".init.text"))) __cold
|
||||
#define __initdata __attribute__ ((__section__ (".init.data")))
|
||||
#define __exitdata __attribute__ ((__section__(".exit.data")))
|
||||
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
|
||||
#define __init __section(.init.text) __cold
|
||||
#define __initdata __section(.init.data)
|
||||
#define __exitdata __section(.exit.data)
|
||||
#define __exit_call __used __section(.exitcall.exit)
|
||||
|
||||
/* modpost check for section mismatches during the kernel build.
|
||||
* A section mismatch happens when there are references from a
|
||||
@@ -52,25 +52,81 @@
|
||||
* when early init has completed so all such references are potential bugs.
|
||||
* For exit sections the same issue exists.
|
||||
* The following markers are used for the cases where the reference to
|
||||
* the init/exit section (code or data) is valid and will teach modpost
|
||||
* not to issue a warning.
|
||||
* the *init / *exit section (code or data) is valid and will teach
|
||||
* modpost not to issue a warning.
|
||||
* The markers follow same syntax rules as __init / __initdata. */
|
||||
#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok")))
|
||||
#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
|
||||
#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok")))
|
||||
#define __ref __section(.ref.text) noinline
|
||||
#define __refdata __section(.ref.data)
|
||||
#define __refconst __section(.ref.rodata)
|
||||
|
||||
/* backward compatibility note
|
||||
* A few places hardcode the old section names:
|
||||
* .text.init.refok
|
||||
* .data.init.refok
|
||||
* .exit.text.refok
|
||||
* They should be converted to use the defines from this file
|
||||
*/
|
||||
|
||||
/* compatibility defines */
|
||||
#define __init_refok __ref
|
||||
#define __initdata_refok __refdata
|
||||
#define __exit_refok __ref
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
#define __exit __attribute__ ((__section__(".exit.text"))) __cold
|
||||
#define __exitused
|
||||
#else
|
||||
#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold
|
||||
#define __exitused __used
|
||||
#endif
|
||||
|
||||
#define __exit __section(.exit.text) __exitused __cold
|
||||
|
||||
/* Used for HOTPLUG */
|
||||
#define __devinit __section(.devinit.text) __cold
|
||||
#define __devinitdata __section(.devinit.data)
|
||||
#define __devinitconst __section(.devinit.rodata)
|
||||
#define __devexit __section(.devexit.text) __exitused __cold
|
||||
#define __devexitdata __section(.devexit.data)
|
||||
#define __devexitconst __section(.devexit.rodata)
|
||||
|
||||
/* Used for HOTPLUG_CPU */
|
||||
#define __cpuinit __section(.cpuinit.text) __cold
|
||||
#define __cpuinitdata __section(.cpuinit.data)
|
||||
#define __cpuinitconst __section(.cpuinit.rodata)
|
||||
#define __cpuexit __section(.cpuexit.text) __exitused __cold
|
||||
#define __cpuexitdata __section(.cpuexit.data)
|
||||
#define __cpuexitconst __section(.cpuexit.rodata)
|
||||
|
||||
/* Used for MEMORY_HOTPLUG */
|
||||
#define __meminit __section(.meminit.text) __cold
|
||||
#define __meminitdata __section(.meminit.data)
|
||||
#define __meminitconst __section(.meminit.rodata)
|
||||
#define __memexit __section(.memexit.text) __exitused __cold
|
||||
#define __memexitdata __section(.memexit.data)
|
||||
#define __memexitconst __section(.memexit.rodata)
|
||||
|
||||
/* For assembly routines */
|
||||
#define __INIT .section ".init.text","ax"
|
||||
#define __INIT_REFOK .section ".text.init.refok","ax"
|
||||
#define __FINIT .previous
|
||||
|
||||
#define __INITDATA .section ".init.data","aw"
|
||||
#define __INITDATA_REFOK .section ".data.init.refok","aw"
|
||||
|
||||
#define __DEVINIT .section ".devinit.text", "ax"
|
||||
#define __DEVINITDATA .section ".devinit.data", "aw"
|
||||
|
||||
#define __CPUINIT .section ".cpuinit.text", "ax"
|
||||
#define __CPUINITDATA .section ".cpuinit.data", "aw"
|
||||
|
||||
#define __MEMINIT .section ".meminit.text", "ax"
|
||||
#define __MEMINITDATA .section ".meminit.data", "aw"
|
||||
|
||||
/* silence warnings when references are OK */
|
||||
#define __REF .section ".ref.text", "ax"
|
||||
#define __REFDATA .section ".ref.data", "aw"
|
||||
#define __REFCONST .section ".ref.rodata", "aw"
|
||||
/* backward compatibility */
|
||||
#define __INIT_REFOK .section __REF
|
||||
#define __INITDATA_REFOK .section __REFDATA
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/*
|
||||
@@ -108,7 +164,7 @@ void prepare_namespace(void);
|
||||
*/
|
||||
|
||||
#define __define_initcall(level,fn,id) \
|
||||
static initcall_t __initcall_##fn##id __attribute_used__ \
|
||||
static initcall_t __initcall_##fn##id __used \
|
||||
__attribute__((__section__(".initcall" level ".init"))) = fn
|
||||
|
||||
/*
|
||||
@@ -142,11 +198,11 @@ void prepare_namespace(void);
|
||||
|
||||
#define console_initcall(fn) \
|
||||
static initcall_t __initcall_##fn \
|
||||
__attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn
|
||||
__used __section(.con_initcall.init) = fn
|
||||
|
||||
#define security_initcall(fn) \
|
||||
static initcall_t __initcall_##fn \
|
||||
__attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn
|
||||
__used __section(.security_initcall.init) = fn
|
||||
|
||||
struct obs_kernel_param {
|
||||
const char *str;
|
||||
@@ -163,8 +219,7 @@ struct obs_kernel_param {
|
||||
#define __setup_param(str, unique_id, fn, early) \
|
||||
static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
|
||||
static struct obs_kernel_param __setup_##unique_id \
|
||||
__attribute_used__ \
|
||||
__attribute__((__section__(".init.setup"))) \
|
||||
__used __section(.init.setup) \
|
||||
__attribute__((aligned((sizeof(long))))) \
|
||||
= { __setup_str_##unique_id, fn, early }
|
||||
|
||||
@@ -242,7 +297,7 @@ void __init parse_early_param(void);
|
||||
#endif
|
||||
|
||||
/* Data marked not to be saved by software suspend */
|
||||
#define __nosavedata __attribute__ ((__section__ (".data.nosave")))
|
||||
#define __nosavedata __section(.data.nosave)
|
||||
|
||||
/* This means "can be init if no module support, otherwise module load
|
||||
may call it." */
|
||||
@@ -254,43 +309,6 @@ void __init parse_early_param(void);
|
||||
#define __initdata_or_module __initdata
|
||||
#endif /*CONFIG_MODULES*/
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
#define __devinit
|
||||
#define __devinitdata
|
||||
#define __devexit
|
||||
#define __devexitdata
|
||||
#else
|
||||
#define __devinit __init
|
||||
#define __devinitdata __initdata
|
||||
#define __devexit __exit
|
||||
#define __devexitdata __exitdata
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
#define __cpuinit
|
||||
#define __cpuinitdata
|
||||
#define __cpuexit
|
||||
#define __cpuexitdata
|
||||
#else
|
||||
#define __cpuinit __init
|
||||
#define __cpuinitdata __initdata
|
||||
#define __cpuexit __exit
|
||||
#define __cpuexitdata __exitdata
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
|
||||
|| defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
|
||||
#define __meminit
|
||||
#define __meminitdata
|
||||
#define __memexit
|
||||
#define __memexitdata
|
||||
#else
|
||||
#define __meminit __init
|
||||
#define __meminitdata __initdata
|
||||
#define __memexit __exit
|
||||
#define __memexitdata __exitdata
|
||||
#endif
|
||||
|
||||
/* Functions marked as __devexit may be discarded at kernel link time, depending
|
||||
on config options. Newer versions of binutils detect references from
|
||||
retained sections to discarded sections and flag an error. Pointers to
|
||||
|
4
include/linux/init_ohci1394_dma.h
Normal file
4
include/linux/init_ohci1394_dma.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
|
||||
extern int __initdata init_ohci1394_dma_early;
|
||||
extern void __init init_ohci1394_dma_on_all_controllers(void);
|
||||
#endif
|
@@ -132,9 +132,11 @@ extern struct group_info init_groups;
|
||||
.cpus_allowed = CPU_MASK_ALL, \
|
||||
.mm = NULL, \
|
||||
.active_mm = &init_mm, \
|
||||
.run_list = LIST_HEAD_INIT(tsk.run_list), \
|
||||
.ioprio = 0, \
|
||||
.time_slice = HZ, \
|
||||
.rt = { \
|
||||
.run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
|
||||
.time_slice = HZ, \
|
||||
.nr_cpus_allowed = NR_CPUS, \
|
||||
}, \
|
||||
.tasks = LIST_HEAD_INIT(tsk.tasks), \
|
||||
.ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \
|
||||
.ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \
|
||||
|
@@ -256,6 +256,7 @@ enum
|
||||
#ifdef CONFIG_HIGH_RES_TIMERS
|
||||
HRTIMER_SOFTIRQ,
|
||||
#endif
|
||||
RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
|
||||
};
|
||||
|
||||
/* softirq mask and active fields moved to irq_cpustat_t in
|
||||
|
95
include/linux/iocontext.h
Normal file
95
include/linux/iocontext.h
Normal file
@@ -0,0 +1,95 @@
|
||||
#ifndef IOCONTEXT_H
|
||||
#define IOCONTEXT_H
|
||||
|
||||
#include <linux/radix-tree.h>
|
||||
|
||||
/*
|
||||
* This is the per-process anticipatory I/O scheduler state.
|
||||
*/
|
||||
struct as_io_context {
|
||||
spinlock_t lock;
|
||||
|
||||
void (*dtor)(struct as_io_context *aic); /* destructor */
|
||||
void (*exit)(struct as_io_context *aic); /* called on task exit */
|
||||
|
||||
unsigned long state;
|
||||
atomic_t nr_queued; /* queued reads & sync writes */
|
||||
atomic_t nr_dispatched; /* number of requests gone to the drivers */
|
||||
|
||||
/* IO History tracking */
|
||||
/* Thinktime */
|
||||
unsigned long last_end_request;
|
||||
unsigned long ttime_total;
|
||||
unsigned long ttime_samples;
|
||||
unsigned long ttime_mean;
|
||||
/* Layout pattern */
|
||||
unsigned int seek_samples;
|
||||
sector_t last_request_pos;
|
||||
u64 seek_total;
|
||||
sector_t seek_mean;
|
||||
};
|
||||
|
||||
struct cfq_queue;
|
||||
struct cfq_io_context {
|
||||
void *key;
|
||||
unsigned long dead_key;
|
||||
|
||||
struct cfq_queue *cfqq[2];
|
||||
|
||||
struct io_context *ioc;
|
||||
|
||||
unsigned long last_end_request;
|
||||
sector_t last_request_pos;
|
||||
|
||||
unsigned long ttime_total;
|
||||
unsigned long ttime_samples;
|
||||
unsigned long ttime_mean;
|
||||
|
||||
unsigned int seek_samples;
|
||||
u64 seek_total;
|
||||
sector_t seek_mean;
|
||||
|
||||
struct list_head queue_list;
|
||||
|
||||
void (*dtor)(struct io_context *); /* destructor */
|
||||
void (*exit)(struct io_context *); /* called on task exit */
|
||||
};
|
||||
|
||||
/*
|
||||
* I/O subsystem state of the associated processes. It is refcounted
|
||||
* and kmalloc'ed. These could be shared between processes.
|
||||
*/
|
||||
struct io_context {
|
||||
atomic_t refcount;
|
||||
atomic_t nr_tasks;
|
||||
|
||||
/* all the fields below are protected by this lock */
|
||||
spinlock_t lock;
|
||||
|
||||
unsigned short ioprio;
|
||||
unsigned short ioprio_changed;
|
||||
|
||||
/*
|
||||
* For request batching
|
||||
*/
|
||||
unsigned long last_waited; /* Time last woken after wait for request */
|
||||
int nr_batch_requests; /* Number of requests left in the batch */
|
||||
|
||||
struct as_io_context *aic;
|
||||
struct radix_tree_root radix_root;
|
||||
void *ioc_data;
|
||||
};
|
||||
|
||||
static inline struct io_context *ioc_task_link(struct io_context *ioc)
|
||||
{
|
||||
/*
|
||||
* if ref count is zero, don't allow sharing (ioc is going away, it's
|
||||
* a race).
|
||||
*/
|
||||
if (ioc && atomic_inc_not_zero(&ioc->refcount))
|
||||
return ioc;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
@@ -8,6 +8,7 @@
|
||||
#ifndef _LINUX_IOPORT_H
|
||||
#define _LINUX_IOPORT_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
/*
|
||||
@@ -153,4 +154,5 @@ extern struct resource * __devm_request_region(struct device *dev,
|
||||
extern void __devm_release_region(struct device *dev, struct resource *parent,
|
||||
resource_size_t start, resource_size_t n);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _LINUX_IOPORT_H */
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define IOPRIO_H
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/iocontext.h>
|
||||
|
||||
/*
|
||||
* Gives us 8 prio classes with 13-bits of data for each class
|
||||
@@ -45,18 +46,18 @@ enum {
|
||||
* the cpu scheduler nice value to an io priority
|
||||
*/
|
||||
#define IOPRIO_NORM (4)
|
||||
static inline int task_ioprio(struct task_struct *task)
|
||||
static inline int task_ioprio(struct io_context *ioc)
|
||||
{
|
||||
if (ioprio_valid(task->ioprio))
|
||||
return IOPRIO_PRIO_DATA(task->ioprio);
|
||||
if (ioprio_valid(ioc->ioprio))
|
||||
return IOPRIO_PRIO_DATA(ioc->ioprio);
|
||||
|
||||
return IOPRIO_NORM;
|
||||
}
|
||||
|
||||
static inline int task_ioprio_class(struct task_struct *task)
|
||||
static inline int task_ioprio_class(struct io_context *ioc)
|
||||
{
|
||||
if (ioprio_valid(task->ioprio))
|
||||
return IOPRIO_PRIO_CLASS(task->ioprio);
|
||||
if (ioprio_valid(ioc->ioprio))
|
||||
return IOPRIO_PRIO_CLASS(ioc->ioprio);
|
||||
|
||||
return IOPRIO_CLASS_BE;
|
||||
}
|
||||
|
@@ -149,6 +149,28 @@ typedef struct journal_header_s
|
||||
__be32 h_sequence;
|
||||
} journal_header_t;
|
||||
|
||||
/*
|
||||
* Checksum types.
|
||||
*/
|
||||
#define JBD2_CRC32_CHKSUM 1
|
||||
#define JBD2_MD5_CHKSUM 2
|
||||
#define JBD2_SHA1_CHKSUM 3
|
||||
|
||||
#define JBD2_CRC32_CHKSUM_SIZE 4
|
||||
|
||||
#define JBD2_CHECKSUM_BYTES (32 / sizeof(u32))
|
||||
/*
|
||||
* Commit block header for storing transactional checksums:
|
||||
*/
|
||||
struct commit_header {
|
||||
__be32 h_magic;
|
||||
__be32 h_blocktype;
|
||||
__be32 h_sequence;
|
||||
unsigned char h_chksum_type;
|
||||
unsigned char h_chksum_size;
|
||||
unsigned char h_padding[2];
|
||||
__be32 h_chksum[JBD2_CHECKSUM_BYTES];
|
||||
};
|
||||
|
||||
/*
|
||||
* The block tag: used to describe a single buffer in the journal.
|
||||
@@ -242,31 +264,25 @@ typedef struct journal_superblock_s
|
||||
((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
|
||||
|
||||
#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
|
||||
#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
|
||||
#define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
|
||||
|
||||
#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
|
||||
#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
|
||||
#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
|
||||
|
||||
/* Features known to this kernel version: */
|
||||
#define JBD2_KNOWN_COMPAT_FEATURES 0
|
||||
#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
|
||||
#define JBD2_KNOWN_ROCOMPAT_FEATURES 0
|
||||
#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
|
||||
JBD2_FEATURE_INCOMPAT_64BIT)
|
||||
JBD2_FEATURE_INCOMPAT_64BIT | \
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#define JBD2_ASSERTIONS
|
||||
#ifdef JBD2_ASSERTIONS
|
||||
#define J_ASSERT(assert) \
|
||||
do { \
|
||||
if (!(assert)) { \
|
||||
printk (KERN_EMERG \
|
||||
"Assertion failure in %s() at %s:%d: \"%s\"\n", \
|
||||
__FUNCTION__, __FILE__, __LINE__, # assert); \
|
||||
BUG(); \
|
||||
} \
|
||||
} while (0)
|
||||
#define J_ASSERT(assert) BUG_ON(!(assert))
|
||||
|
||||
#if defined(CONFIG_BUFFER_DEBUG)
|
||||
void buffer_assertion_failure(struct buffer_head *bh);
|
||||
@@ -282,10 +298,6 @@ void buffer_assertion_failure(struct buffer_head *bh);
|
||||
#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define J_ASSERT(assert) do { } while (0)
|
||||
#endif /* JBD2_ASSERTIONS */
|
||||
|
||||
#if defined(JBD2_PARANOID_IOFAIL)
|
||||
#define J_EXPECT(expr, why...) J_ASSERT(expr)
|
||||
#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
|
||||
@@ -406,9 +418,23 @@ struct handle_s
|
||||
unsigned int h_sync: 1; /* sync-on-close */
|
||||
unsigned int h_jdata: 1; /* force data journaling */
|
||||
unsigned int h_aborted: 1; /* fatal error on handle */
|
||||
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
struct lockdep_map h_lockdep_map;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Some stats for checkpoint phase
|
||||
*/
|
||||
struct transaction_chp_stats_s {
|
||||
unsigned long cs_chp_time;
|
||||
unsigned long cs_forced_to_close;
|
||||
unsigned long cs_written;
|
||||
unsigned long cs_dropped;
|
||||
};
|
||||
|
||||
/* The transaction_t type is the guts of the journaling mechanism. It
|
||||
* tracks a compound transaction through its various states:
|
||||
*
|
||||
@@ -456,6 +482,8 @@ struct transaction_s
|
||||
/*
|
||||
* Transaction's current state
|
||||
* [no locking - only kjournald2 alters this]
|
||||
* [j_list_lock] guards transition of a transaction into T_FINISHED
|
||||
* state and subsequent call of __jbd2_journal_drop_transaction()
|
||||
* FIXME: needs barriers
|
||||
* KLUDGE: [use j_state_lock]
|
||||
*/
|
||||
@@ -543,6 +571,21 @@ struct transaction_s
|
||||
*/
|
||||
spinlock_t t_handle_lock;
|
||||
|
||||
/*
|
||||
* Longest time some handle had to wait for running transaction
|
||||
*/
|
||||
unsigned long t_max_wait;
|
||||
|
||||
/*
|
||||
* When transaction started
|
||||
*/
|
||||
unsigned long t_start;
|
||||
|
||||
/*
|
||||
* Checkpointing stats [j_checkpoint_sem]
|
||||
*/
|
||||
struct transaction_chp_stats_s t_chp_stats;
|
||||
|
||||
/*
|
||||
* Number of outstanding updates running on this transaction
|
||||
* [t_handle_lock]
|
||||
@@ -574,6 +617,39 @@ struct transaction_s
|
||||
|
||||
};
|
||||
|
||||
struct transaction_run_stats_s {
|
||||
unsigned long rs_wait;
|
||||
unsigned long rs_running;
|
||||
unsigned long rs_locked;
|
||||
unsigned long rs_flushing;
|
||||
unsigned long rs_logging;
|
||||
|
||||
unsigned long rs_handle_count;
|
||||
unsigned long rs_blocks;
|
||||
unsigned long rs_blocks_logged;
|
||||
};
|
||||
|
||||
struct transaction_stats_s {
|
||||
int ts_type;
|
||||
unsigned long ts_tid;
|
||||
union {
|
||||
struct transaction_run_stats_s run;
|
||||
struct transaction_chp_stats_s chp;
|
||||
} u;
|
||||
};
|
||||
|
||||
#define JBD2_STATS_RUN 1
|
||||
#define JBD2_STATS_CHECKPOINT 2
|
||||
|
||||
static inline unsigned long
|
||||
jbd2_time_diff(unsigned long start, unsigned long end)
|
||||
{
|
||||
if (end >= start)
|
||||
return end - start;
|
||||
|
||||
return end + (MAX_JIFFY_OFFSET - start);
|
||||
}
|
||||
|
||||
/**
|
||||
* struct journal_s - The journal_s type is the concrete type associated with
|
||||
* journal_t.
|
||||
@@ -635,6 +711,12 @@ struct transaction_s
|
||||
* @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
|
||||
* number that will fit in j_blocksize
|
||||
* @j_last_sync_writer: most recent pid which did a synchronous write
|
||||
* @j_history: Buffer storing the transactions statistics history
|
||||
* @j_history_max: Maximum number of transactions in the statistics history
|
||||
* @j_history_cur: Current number of transactions in the statistics history
|
||||
* @j_history_lock: Protect the transactions statistics history
|
||||
* @j_proc_entry: procfs entry for the jbd statistics directory
|
||||
* @j_stats: Overall statistics
|
||||
* @j_private: An opaque pointer to fs-private information.
|
||||
*/
|
||||
|
||||
@@ -826,6 +908,19 @@ struct journal_s
|
||||
|
||||
pid_t j_last_sync_writer;
|
||||
|
||||
/*
|
||||
* Journal statistics
|
||||
*/
|
||||
struct transaction_stats_s *j_history;
|
||||
int j_history_max;
|
||||
int j_history_cur;
|
||||
/*
|
||||
* Protect the transactions statistics history
|
||||
*/
|
||||
spinlock_t j_history_lock;
|
||||
struct proc_dir_entry *j_proc_entry;
|
||||
struct transaction_stats_s j_stats;
|
||||
|
||||
/*
|
||||
* An opaque pointer to fs-private information. ext3 puts its
|
||||
* superblock pointer here
|
||||
@@ -932,6 +1027,8 @@ extern int jbd2_journal_check_available_features
|
||||
(journal_t *, unsigned long, unsigned long, unsigned long);
|
||||
extern int jbd2_journal_set_features
|
||||
(journal_t *, unsigned long, unsigned long, unsigned long);
|
||||
extern void jbd2_journal_clear_features
|
||||
(journal_t *, unsigned long, unsigned long, unsigned long);
|
||||
extern int jbd2_journal_create (journal_t *);
|
||||
extern int jbd2_journal_load (journal_t *journal);
|
||||
extern void jbd2_journal_destroy (journal_t *);
|
||||
|
@@ -29,6 +29,12 @@
|
||||
# define SHIFT_HZ 9
|
||||
#elif HZ >= 768 && HZ < 1536
|
||||
# define SHIFT_HZ 10
|
||||
#elif HZ >= 1536 && HZ < 3072
|
||||
# define SHIFT_HZ 11
|
||||
#elif HZ >= 3072 && HZ < 6144
|
||||
# define SHIFT_HZ 12
|
||||
#elif HZ >= 6144 && HZ < 12288
|
||||
# define SHIFT_HZ 13
|
||||
#else
|
||||
# error You lose.
|
||||
#endif
|
||||
|
@@ -105,8 +105,8 @@ struct user;
|
||||
* supposed to.
|
||||
*/
|
||||
#ifdef CONFIG_PREEMPT_VOLUNTARY
|
||||
extern int cond_resched(void);
|
||||
# define might_resched() cond_resched()
|
||||
extern int _cond_resched(void);
|
||||
# define might_resched() _cond_resched()
|
||||
#else
|
||||
# define might_resched() do { } while (0)
|
||||
#endif
|
||||
@@ -194,6 +194,9 @@ static inline int log_buf_read(int idx) { return 0; }
|
||||
static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
|
||||
#endif
|
||||
|
||||
extern void __attribute__((format(printf, 1, 2)))
|
||||
early_printk(const char *fmt, ...);
|
||||
|
||||
unsigned long int_sqrt(unsigned long);
|
||||
|
||||
extern int printk_ratelimit(void);
|
||||
|
@@ -3,15 +3,14 @@
|
||||
*
|
||||
* Copyright (c) 2002-2003 Patrick Mochel
|
||||
* Copyright (c) 2002-2003 Open Source Development Labs
|
||||
* Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com>
|
||||
* Copyright (c) 2006-2007 Novell Inc.
|
||||
* Copyright (c) 2006-2008 Greg Kroah-Hartman <greg@kroah.com>
|
||||
* Copyright (c) 2006-2008 Novell Inc.
|
||||
*
|
||||
* This file is released under the GPLv2.
|
||||
*
|
||||
*
|
||||
* Please read Documentation/kobject.txt before using the kobject
|
||||
* interface, ESPECIALLY the parts about reference counts and object
|
||||
* destructors.
|
||||
* destructors.
|
||||
*/
|
||||
|
||||
#ifndef _KOBJECT_H_
|
||||
@@ -61,48 +60,54 @@ enum kobject_action {
|
||||
};
|
||||
|
||||
struct kobject {
|
||||
const char * k_name;
|
||||
const char *name;
|
||||
struct kref kref;
|
||||
struct list_head entry;
|
||||
struct kobject * parent;
|
||||
struct kset * kset;
|
||||
struct kobj_type * ktype;
|
||||
struct sysfs_dirent * sd;
|
||||
struct kobject *parent;
|
||||
struct kset *kset;
|
||||
struct kobj_type *ktype;
|
||||
struct sysfs_dirent *sd;
|
||||
unsigned int state_initialized:1;
|
||||
unsigned int state_in_sysfs:1;
|
||||
unsigned int state_add_uevent_sent:1;
|
||||
unsigned int state_remove_uevent_sent:1;
|
||||
};
|
||||
|
||||
extern int kobject_set_name(struct kobject *, const char *, ...)
|
||||
__attribute__((format(printf,2,3)));
|
||||
extern int kobject_set_name(struct kobject *kobj, const char *name, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
|
||||
static inline const char * kobject_name(const struct kobject * kobj)
|
||||
static inline const char *kobject_name(const struct kobject *kobj)
|
||||
{
|
||||
return kobj->k_name;
|
||||
return kobj->name;
|
||||
}
|
||||
|
||||
extern void kobject_init(struct kobject *);
|
||||
extern void kobject_cleanup(struct kobject *);
|
||||
extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
|
||||
extern int __must_check kobject_add(struct kobject *kobj,
|
||||
struct kobject *parent,
|
||||
const char *fmt, ...);
|
||||
extern int __must_check kobject_init_and_add(struct kobject *kobj,
|
||||
struct kobj_type *ktype,
|
||||
struct kobject *parent,
|
||||
const char *fmt, ...);
|
||||
|
||||
extern int __must_check kobject_add(struct kobject *);
|
||||
extern void kobject_del(struct kobject *);
|
||||
extern void kobject_del(struct kobject *kobj);
|
||||
|
||||
extern struct kobject * __must_check kobject_create(void);
|
||||
extern struct kobject * __must_check kobject_create_and_add(const char *name,
|
||||
struct kobject *parent);
|
||||
|
||||
extern int __must_check kobject_rename(struct kobject *, const char *new_name);
|
||||
extern int __must_check kobject_move(struct kobject *, struct kobject *);
|
||||
|
||||
extern int __must_check kobject_register(struct kobject *);
|
||||
extern void kobject_unregister(struct kobject *);
|
||||
extern struct kobject *kobject_get(struct kobject *kobj);
|
||||
extern void kobject_put(struct kobject *kobj);
|
||||
|
||||
extern struct kobject * kobject_get(struct kobject *);
|
||||
extern void kobject_put(struct kobject *);
|
||||
|
||||
extern struct kobject *kobject_kset_add_dir(struct kset *kset,
|
||||
struct kobject *, const char *);
|
||||
extern struct kobject *kobject_add_dir(struct kobject *, const char *);
|
||||
|
||||
extern char * kobject_get_path(struct kobject *, gfp_t);
|
||||
extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
|
||||
|
||||
struct kobj_type {
|
||||
void (*release)(struct kobject *);
|
||||
struct sysfs_ops * sysfs_ops;
|
||||
struct attribute ** default_attrs;
|
||||
void (*release)(struct kobject *kobj);
|
||||
struct sysfs_ops *sysfs_ops;
|
||||
struct attribute **default_attrs;
|
||||
};
|
||||
|
||||
struct kobj_uevent_env {
|
||||
@@ -119,6 +124,16 @@ struct kset_uevent_ops {
|
||||
struct kobj_uevent_env *env);
|
||||
};
|
||||
|
||||
struct kobj_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
char *buf);
|
||||
ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
const char *buf, size_t count);
|
||||
};
|
||||
|
||||
extern struct sysfs_ops kobj_sysfs_ops;
|
||||
|
||||
/**
|
||||
* struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
|
||||
*
|
||||
@@ -128,7 +143,6 @@ struct kset_uevent_ops {
|
||||
* define the attribute callbacks and other common events that happen to
|
||||
* a kobject.
|
||||
*
|
||||
* @ktype: the struct kobj_type for this specific kset
|
||||
* @list: the list of all kobjects for this kset
|
||||
* @list_lock: a lock for iterating over the kobjects
|
||||
* @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
|
||||
@@ -138,99 +152,49 @@ struct kset_uevent_ops {
|
||||
* desired.
|
||||
*/
|
||||
struct kset {
|
||||
struct kobj_type *ktype;
|
||||
struct list_head list;
|
||||
spinlock_t list_lock;
|
||||
struct kobject kobj;
|
||||
struct kset_uevent_ops *uevent_ops;
|
||||
struct list_head list;
|
||||
spinlock_t list_lock;
|
||||
struct kobject kobj;
|
||||
struct kset_uevent_ops *uevent_ops;
|
||||
};
|
||||
|
||||
extern void kset_init(struct kset *kset);
|
||||
extern int __must_check kset_register(struct kset *kset);
|
||||
extern void kset_unregister(struct kset *kset);
|
||||
extern struct kset * __must_check kset_create_and_add(const char *name,
|
||||
struct kset_uevent_ops *u,
|
||||
struct kobject *parent_kobj);
|
||||
|
||||
extern void kset_init(struct kset * k);
|
||||
extern int __must_check kset_add(struct kset * k);
|
||||
extern int __must_check kset_register(struct kset * k);
|
||||
extern void kset_unregister(struct kset * k);
|
||||
|
||||
static inline struct kset * to_kset(struct kobject * kobj)
|
||||
static inline struct kset *to_kset(struct kobject *kobj)
|
||||
{
|
||||
return kobj ? container_of(kobj,struct kset,kobj) : NULL;
|
||||
return kobj ? container_of(kobj, struct kset, kobj) : NULL;
|
||||
}
|
||||
|
||||
static inline struct kset * kset_get(struct kset * k)
|
||||
static inline struct kset *kset_get(struct kset *k)
|
||||
{
|
||||
return k ? to_kset(kobject_get(&k->kobj)) : NULL;
|
||||
}
|
||||
|
||||
static inline void kset_put(struct kset * k)
|
||||
static inline void kset_put(struct kset *k)
|
||||
{
|
||||
kobject_put(&k->kobj);
|
||||
}
|
||||
|
||||
static inline struct kobj_type * get_ktype(struct kobject * k)
|
||||
static inline struct kobj_type *get_ktype(struct kobject *kobj)
|
||||
{
|
||||
if (k->kset && k->kset->ktype)
|
||||
return k->kset->ktype;
|
||||
else
|
||||
return k->ktype;
|
||||
return kobj->ktype;
|
||||
}
|
||||
|
||||
extern struct kobject * kset_find_obj(struct kset *, const char *);
|
||||
extern struct kobject *kset_find_obj(struct kset *, const char *);
|
||||
|
||||
|
||||
/*
|
||||
* Use this when initializing an embedded kset with no other
|
||||
* fields to initialize.
|
||||
*/
|
||||
#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
|
||||
|
||||
|
||||
#define decl_subsys(_name,_type,_uevent_ops) \
|
||||
struct kset _name##_subsys = { \
|
||||
.kobj = { .k_name = __stringify(_name) }, \
|
||||
.ktype = _type, \
|
||||
.uevent_ops =_uevent_ops, \
|
||||
}
|
||||
#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
|
||||
struct kset _varname##_subsys = { \
|
||||
.kobj = { .k_name = __stringify(_name) }, \
|
||||
.ktype = _type, \
|
||||
.uevent_ops =_uevent_ops, \
|
||||
}
|
||||
|
||||
/* The global /sys/kernel/ subsystem for people to chain off of */
|
||||
extern struct kset kernel_subsys;
|
||||
/* The global /sys/hypervisor/ subsystem */
|
||||
extern struct kset hypervisor_subsys;
|
||||
|
||||
/*
|
||||
* Helpers for setting the kset of registered objects.
|
||||
* Often, a registered object belongs to a kset embedded in a
|
||||
* subsystem. These do no magic, just make the resulting code
|
||||
* easier to follow.
|
||||
*/
|
||||
|
||||
/**
|
||||
* kobj_set_kset_s(obj,subsys) - set kset for embedded kobject.
|
||||
* @obj: ptr to some object type.
|
||||
* @subsys: a subsystem object (not a ptr).
|
||||
*
|
||||
* Can be used for any object type with an embedded ->kobj.
|
||||
*/
|
||||
|
||||
#define kobj_set_kset_s(obj,subsys) \
|
||||
(obj)->kobj.kset = &(subsys)
|
||||
|
||||
extern int __must_check subsystem_register(struct kset *);
|
||||
extern void subsystem_unregister(struct kset *);
|
||||
|
||||
struct subsys_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct kset *, char *);
|
||||
ssize_t (*store)(struct kset *, const char *, size_t);
|
||||
};
|
||||
|
||||
extern int __must_check subsys_create_file(struct kset *,
|
||||
struct subsys_attribute *);
|
||||
/* The global /sys/kernel/ kobject for people to chain off of */
|
||||
extern struct kobject *kernel_kobj;
|
||||
/* The global /sys/hypervisor/ kobject for people to chain off of */
|
||||
extern struct kobject *hypervisor_kobj;
|
||||
/* The global /sys/power/ kobject for people to chain off of */
|
||||
extern struct kobject *power_kobj;
|
||||
/* The global /sys/firmware/ kobject for people to chain off of */
|
||||
extern struct kobject *firmware_kobj;
|
||||
|
||||
#if defined(CONFIG_HOTPLUG)
|
||||
int kobject_uevent(struct kobject *kobj, enum kobject_action action);
|
||||
@@ -243,18 +207,20 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
|
||||
int kobject_action_type(const char *buf, size_t count,
|
||||
enum kobject_action *type);
|
||||
#else
|
||||
static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action)
|
||||
static inline int kobject_uevent(struct kobject *kobj,
|
||||
enum kobject_action action)
|
||||
{ return 0; }
|
||||
static inline int kobject_uevent_env(struct kobject *kobj,
|
||||
enum kobject_action action,
|
||||
char *envp[])
|
||||
{ return 0; }
|
||||
|
||||
static inline int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
|
||||
static inline int add_uevent_var(struct kobj_uevent_env *env,
|
||||
const char *format, ...)
|
||||
{ return 0; }
|
||||
|
||||
static inline int kobject_action_type(const char *buf, size_t count,
|
||||
enum kobject_action *type)
|
||||
enum kobject_action *type)
|
||||
{ return -EINVAL; }
|
||||
#endif
|
||||
|
||||
|
@@ -182,6 +182,15 @@ static inline void kretprobe_assert(struct kretprobe_instance *ri,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KPROBES_SANITY_TEST
|
||||
extern int init_test_probes(void);
|
||||
#else
|
||||
static inline int init_test_probes(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_KPROBES_SANITY_TEST */
|
||||
|
||||
extern spinlock_t kretprobe_lock;
|
||||
extern struct mutex kprobe_mutex;
|
||||
extern int arch_prepare_kprobe(struct kprobe *p);
|
||||
@@ -227,6 +236,7 @@ void unregister_kretprobe(struct kretprobe *rp);
|
||||
|
||||
void kprobe_flush_task(struct task_struct *tk);
|
||||
void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
|
||||
|
||||
#else /* CONFIG_KPROBES */
|
||||
|
||||
#define __kprobes /**/
|
||||
|
@@ -24,6 +24,7 @@ struct kref {
|
||||
atomic_t refcount;
|
||||
};
|
||||
|
||||
void kref_set(struct kref *kref, int num);
|
||||
void kref_init(struct kref *kref);
|
||||
void kref_get(struct kref *kref);
|
||||
int kref_put(struct kref *kref, void (*release) (struct kref *kref));
|
||||
|
@@ -9,12 +9,10 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <asm/kvm.h>
|
||||
|
||||
#define KVM_API_VERSION 12
|
||||
|
||||
/* Architectural interrupt line count. */
|
||||
#define KVM_NR_INTERRUPTS 256
|
||||
|
||||
/* for KVM_CREATE_MEMORY_REGION */
|
||||
struct kvm_memory_region {
|
||||
__u32 slot;
|
||||
@@ -23,16 +21,18 @@ struct kvm_memory_region {
|
||||
__u64 memory_size; /* bytes */
|
||||
};
|
||||
|
||||
/* for KVM_SET_USER_MEMORY_REGION */
|
||||
struct kvm_userspace_memory_region {
|
||||
__u32 slot;
|
||||
__u32 flags;
|
||||
__u64 guest_phys_addr;
|
||||
__u64 memory_size; /* bytes */
|
||||
__u64 userspace_addr; /* start of the userspace allocated memory */
|
||||
};
|
||||
|
||||
/* for kvm_memory_region::flags */
|
||||
#define KVM_MEM_LOG_DIRTY_PAGES 1UL
|
||||
|
||||
struct kvm_memory_alias {
|
||||
__u32 slot; /* this has a different namespace than memory slots */
|
||||
__u32 flags;
|
||||
__u64 guest_phys_addr;
|
||||
__u64 memory_size;
|
||||
__u64 target_phys_addr;
|
||||
};
|
||||
|
||||
/* for KVM_IRQ_LINE */
|
||||
struct kvm_irq_level {
|
||||
@@ -45,62 +45,18 @@ struct kvm_irq_level {
|
||||
__u32 level;
|
||||
};
|
||||
|
||||
/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
|
||||
struct kvm_pic_state {
|
||||
__u8 last_irr; /* edge detection */
|
||||
__u8 irr; /* interrupt request register */
|
||||
__u8 imr; /* interrupt mask register */
|
||||
__u8 isr; /* interrupt service register */
|
||||
__u8 priority_add; /* highest irq priority */
|
||||
__u8 irq_base;
|
||||
__u8 read_reg_select;
|
||||
__u8 poll;
|
||||
__u8 special_mask;
|
||||
__u8 init_state;
|
||||
__u8 auto_eoi;
|
||||
__u8 rotate_on_auto_eoi;
|
||||
__u8 special_fully_nested_mode;
|
||||
__u8 init4; /* true if 4 byte init */
|
||||
__u8 elcr; /* PIIX edge/trigger selection */
|
||||
__u8 elcr_mask;
|
||||
};
|
||||
|
||||
#define KVM_IOAPIC_NUM_PINS 24
|
||||
struct kvm_ioapic_state {
|
||||
__u64 base_address;
|
||||
__u32 ioregsel;
|
||||
__u32 id;
|
||||
__u32 irr;
|
||||
__u32 pad;
|
||||
union {
|
||||
__u64 bits;
|
||||
struct {
|
||||
__u8 vector;
|
||||
__u8 delivery_mode:3;
|
||||
__u8 dest_mode:1;
|
||||
__u8 delivery_status:1;
|
||||
__u8 polarity:1;
|
||||
__u8 remote_irr:1;
|
||||
__u8 trig_mode:1;
|
||||
__u8 mask:1;
|
||||
__u8 reserve:7;
|
||||
__u8 reserved[4];
|
||||
__u8 dest_id;
|
||||
} fields;
|
||||
} redirtbl[KVM_IOAPIC_NUM_PINS];
|
||||
};
|
||||
|
||||
#define KVM_IRQCHIP_PIC_MASTER 0
|
||||
#define KVM_IRQCHIP_PIC_SLAVE 1
|
||||
#define KVM_IRQCHIP_IOAPIC 2
|
||||
|
||||
struct kvm_irqchip {
|
||||
__u32 chip_id;
|
||||
__u32 pad;
|
||||
union {
|
||||
char dummy[512]; /* reserving space */
|
||||
#ifdef CONFIG_X86
|
||||
struct kvm_pic_state pic;
|
||||
#endif
|
||||
#if defined(CONFIG_X86) || defined(CONFIG_IA64)
|
||||
struct kvm_ioapic_state ioapic;
|
||||
#endif
|
||||
} chip;
|
||||
};
|
||||
|
||||
@@ -116,6 +72,7 @@ struct kvm_irqchip {
|
||||
#define KVM_EXIT_FAIL_ENTRY 9
|
||||
#define KVM_EXIT_INTR 10
|
||||
#define KVM_EXIT_SET_TPR 11
|
||||
#define KVM_EXIT_TPR_ACCESS 12
|
||||
|
||||
/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
|
||||
struct kvm_run {
|
||||
@@ -174,90 +131,17 @@ struct kvm_run {
|
||||
__u32 longmode;
|
||||
__u32 pad;
|
||||
} hypercall;
|
||||
/* KVM_EXIT_TPR_ACCESS */
|
||||
struct {
|
||||
__u64 rip;
|
||||
__u32 is_write;
|
||||
__u32 pad;
|
||||
} tpr_access;
|
||||
/* Fix the size of the union. */
|
||||
char padding[256];
|
||||
};
|
||||
};
|
||||
|
||||
/* for KVM_GET_REGS and KVM_SET_REGS */
|
||||
struct kvm_regs {
|
||||
/* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
|
||||
__u64 rax, rbx, rcx, rdx;
|
||||
__u64 rsi, rdi, rsp, rbp;
|
||||
__u64 r8, r9, r10, r11;
|
||||
__u64 r12, r13, r14, r15;
|
||||
__u64 rip, rflags;
|
||||
};
|
||||
|
||||
/* for KVM_GET_FPU and KVM_SET_FPU */
|
||||
struct kvm_fpu {
|
||||
__u8 fpr[8][16];
|
||||
__u16 fcw;
|
||||
__u16 fsw;
|
||||
__u8 ftwx; /* in fxsave format */
|
||||
__u8 pad1;
|
||||
__u16 last_opcode;
|
||||
__u64 last_ip;
|
||||
__u64 last_dp;
|
||||
__u8 xmm[16][16];
|
||||
__u32 mxcsr;
|
||||
__u32 pad2;
|
||||
};
|
||||
|
||||
/* for KVM_GET_LAPIC and KVM_SET_LAPIC */
|
||||
#define KVM_APIC_REG_SIZE 0x400
|
||||
struct kvm_lapic_state {
|
||||
char regs[KVM_APIC_REG_SIZE];
|
||||
};
|
||||
|
||||
struct kvm_segment {
|
||||
__u64 base;
|
||||
__u32 limit;
|
||||
__u16 selector;
|
||||
__u8 type;
|
||||
__u8 present, dpl, db, s, l, g, avl;
|
||||
__u8 unusable;
|
||||
__u8 padding;
|
||||
};
|
||||
|
||||
struct kvm_dtable {
|
||||
__u64 base;
|
||||
__u16 limit;
|
||||
__u16 padding[3];
|
||||
};
|
||||
|
||||
/* for KVM_GET_SREGS and KVM_SET_SREGS */
|
||||
struct kvm_sregs {
|
||||
/* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */
|
||||
struct kvm_segment cs, ds, es, fs, gs, ss;
|
||||
struct kvm_segment tr, ldt;
|
||||
struct kvm_dtable gdt, idt;
|
||||
__u64 cr0, cr2, cr3, cr4, cr8;
|
||||
__u64 efer;
|
||||
__u64 apic_base;
|
||||
__u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
|
||||
};
|
||||
|
||||
struct kvm_msr_entry {
|
||||
__u32 index;
|
||||
__u32 reserved;
|
||||
__u64 data;
|
||||
};
|
||||
|
||||
/* for KVM_GET_MSRS and KVM_SET_MSRS */
|
||||
struct kvm_msrs {
|
||||
__u32 nmsrs; /* number of msrs in entries */
|
||||
__u32 pad;
|
||||
|
||||
struct kvm_msr_entry entries[0];
|
||||
};
|
||||
|
||||
/* for KVM_GET_MSR_INDEX_LIST */
|
||||
struct kvm_msr_list {
|
||||
__u32 nmsrs; /* number of msrs in entries */
|
||||
__u32 indices[0];
|
||||
};
|
||||
|
||||
/* for KVM_TRANSLATE */
|
||||
struct kvm_translation {
|
||||
/* in */
|
||||
@@ -302,28 +186,24 @@ struct kvm_dirty_log {
|
||||
};
|
||||
};
|
||||
|
||||
struct kvm_cpuid_entry {
|
||||
__u32 function;
|
||||
__u32 eax;
|
||||
__u32 ebx;
|
||||
__u32 ecx;
|
||||
__u32 edx;
|
||||
__u32 padding;
|
||||
};
|
||||
|
||||
/* for KVM_SET_CPUID */
|
||||
struct kvm_cpuid {
|
||||
__u32 nent;
|
||||
__u32 padding;
|
||||
struct kvm_cpuid_entry entries[0];
|
||||
};
|
||||
|
||||
/* for KVM_SET_SIGNAL_MASK */
|
||||
struct kvm_signal_mask {
|
||||
__u32 len;
|
||||
__u8 sigset[0];
|
||||
};
|
||||
|
||||
/* for KVM_TPR_ACCESS_REPORTING */
|
||||
struct kvm_tpr_access_ctl {
|
||||
__u32 enabled;
|
||||
__u32 flags;
|
||||
__u32 reserved[8];
|
||||
};
|
||||
|
||||
/* for KVM_SET_VAPIC_ADDR */
|
||||
struct kvm_vapic_addr {
|
||||
__u64 vapic_addr;
|
||||
};
|
||||
|
||||
#define KVMIO 0xAE
|
||||
|
||||
/*
|
||||
@@ -347,11 +227,21 @@ struct kvm_signal_mask {
|
||||
*/
|
||||
#define KVM_CAP_IRQCHIP 0
|
||||
#define KVM_CAP_HLT 1
|
||||
#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2
|
||||
#define KVM_CAP_USER_MEMORY 3
|
||||
#define KVM_CAP_SET_TSS_ADDR 4
|
||||
#define KVM_CAP_EXT_CPUID 5
|
||||
#define KVM_CAP_VAPIC 6
|
||||
|
||||
/*
|
||||
* ioctls for VM fds
|
||||
*/
|
||||
#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
|
||||
#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
|
||||
#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
|
||||
#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
|
||||
struct kvm_userspace_memory_region)
|
||||
#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
|
||||
/*
|
||||
* KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
|
||||
* a vcpu fd.
|
||||
@@ -359,6 +249,7 @@ struct kvm_signal_mask {
|
||||
#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
|
||||
#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
|
||||
#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
|
||||
#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x48, struct kvm_cpuid2)
|
||||
/* Device model IOC */
|
||||
#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
|
||||
#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
|
||||
@@ -384,5 +275,11 @@ struct kvm_signal_mask {
|
||||
#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu)
|
||||
#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state)
|
||||
#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state)
|
||||
#define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2)
|
||||
#define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
|
||||
/* Available with KVM_CAP_VAPIC */
|
||||
#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
|
||||
/* Available with KVM_CAP_VAPIC */
|
||||
#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
|
||||
|
||||
#endif
|
||||
|
299
include/linux/kvm_host.h
Normal file
299
include/linux/kvm_host.h
Normal file
@@ -0,0 +1,299 @@
|
||||
#ifndef __KVM_HOST_H
|
||||
#define __KVM_HOST_H
|
||||
|
||||
/*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2. See
|
||||
* the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/signal.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/preempt.h>
|
||||
#include <asm/signal.h>
|
||||
|
||||
#include <linux/kvm.h>
|
||||
#include <linux/kvm_para.h>
|
||||
|
||||
#include <linux/kvm_types.h>
|
||||
|
||||
#include <asm/kvm_host.h>
|
||||
|
||||
#define KVM_MAX_VCPUS 4
|
||||
#define KVM_MEMORY_SLOTS 8
|
||||
/* memory slots that does not exposed to userspace */
|
||||
#define KVM_PRIVATE_MEM_SLOTS 4
|
||||
|
||||
#define KVM_PIO_PAGE_OFFSET 1
|
||||
|
||||
/*
|
||||
* vcpu->requests bit members
|
||||
*/
|
||||
#define KVM_REQ_TLB_FLUSH 0
|
||||
#define KVM_REQ_MIGRATE_TIMER 1
|
||||
#define KVM_REQ_REPORT_TPR_ACCESS 2
|
||||
|
||||
struct kvm_vcpu;
|
||||
extern struct kmem_cache *kvm_vcpu_cache;
|
||||
|
||||
struct kvm_guest_debug {
|
||||
int enabled;
|
||||
unsigned long bp[4];
|
||||
int singlestep;
|
||||
};
|
||||
|
||||
/*
|
||||
* It would be nice to use something smarter than a linear search, TBD...
|
||||
* Thankfully we dont expect many devices to register (famous last words :),
|
||||
* so until then it will suffice. At least its abstracted so we can change
|
||||
* in one place.
|
||||
*/
|
||||
struct kvm_io_bus {
|
||||
int dev_count;
|
||||
#define NR_IOBUS_DEVS 6
|
||||
struct kvm_io_device *devs[NR_IOBUS_DEVS];
|
||||
};
|
||||
|
||||
void kvm_io_bus_init(struct kvm_io_bus *bus);
|
||||
void kvm_io_bus_destroy(struct kvm_io_bus *bus);
|
||||
struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, gpa_t addr);
|
||||
void kvm_io_bus_register_dev(struct kvm_io_bus *bus,
|
||||
struct kvm_io_device *dev);
|
||||
|
||||
struct kvm_vcpu {
|
||||
struct kvm *kvm;
|
||||
struct preempt_notifier preempt_notifier;
|
||||
int vcpu_id;
|
||||
struct mutex mutex;
|
||||
int cpu;
|
||||
struct kvm_run *run;
|
||||
int guest_mode;
|
||||
unsigned long requests;
|
||||
struct kvm_guest_debug guest_debug;
|
||||
int fpu_active;
|
||||
int guest_fpu_loaded;
|
||||
wait_queue_head_t wq;
|
||||
int sigset_active;
|
||||
sigset_t sigset;
|
||||
struct kvm_vcpu_stat stat;
|
||||
|
||||
#ifdef CONFIG_HAS_IOMEM
|
||||
int mmio_needed;
|
||||
int mmio_read_completed;
|
||||
int mmio_is_write;
|
||||
int mmio_size;
|
||||
unsigned char mmio_data[8];
|
||||
gpa_t mmio_phys_addr;
|
||||
#endif
|
||||
|
||||
struct kvm_vcpu_arch arch;
|
||||
};
|
||||
|
||||
struct kvm_memory_slot {
|
||||
gfn_t base_gfn;
|
||||
unsigned long npages;
|
||||
unsigned long flags;
|
||||
unsigned long *rmap;
|
||||
unsigned long *dirty_bitmap;
|
||||
unsigned long userspace_addr;
|
||||
int user_alloc;
|
||||
};
|
||||
|
||||
struct kvm {
|
||||
struct mutex lock; /* protects the vcpus array and APIC accesses */
|
||||
spinlock_t mmu_lock;
|
||||
struct mm_struct *mm; /* userspace tied to this vm */
|
||||
int nmemslots;
|
||||
struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
|
||||
KVM_PRIVATE_MEM_SLOTS];
|
||||
struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
|
||||
struct list_head vm_list;
|
||||
struct file *filp;
|
||||
struct kvm_io_bus mmio_bus;
|
||||
struct kvm_io_bus pio_bus;
|
||||
struct kvm_vm_stat stat;
|
||||
struct kvm_arch arch;
|
||||
};
|
||||
|
||||
/* The guest did something we don't support. */
|
||||
#define pr_unimpl(vcpu, fmt, ...) \
|
||||
do { \
|
||||
if (printk_ratelimit()) \
|
||||
printk(KERN_ERR "kvm: %i: cpu%i " fmt, \
|
||||
current->tgid, (vcpu)->vcpu_id , ## __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt)
|
||||
#define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt)
|
||||
|
||||
int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
|
||||
void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
|
||||
|
||||
void vcpu_load(struct kvm_vcpu *vcpu);
|
||||
void vcpu_put(struct kvm_vcpu *vcpu);
|
||||
|
||||
void decache_vcpus_on_cpu(int cpu);
|
||||
|
||||
|
||||
int kvm_init(void *opaque, unsigned int vcpu_size,
|
||||
struct module *module);
|
||||
void kvm_exit(void);
|
||||
|
||||
#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
|
||||
#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
|
||||
static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
|
||||
struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
|
||||
|
||||
extern struct page *bad_page;
|
||||
|
||||
int is_error_page(struct page *page);
|
||||
int kvm_is_error_hva(unsigned long addr);
|
||||
int kvm_set_memory_region(struct kvm *kvm,
|
||||
struct kvm_userspace_memory_region *mem,
|
||||
int user_alloc);
|
||||
int __kvm_set_memory_region(struct kvm *kvm,
|
||||
struct kvm_userspace_memory_region *mem,
|
||||
int user_alloc);
|
||||
int kvm_arch_set_memory_region(struct kvm *kvm,
|
||||
struct kvm_userspace_memory_region *mem,
|
||||
struct kvm_memory_slot old,
|
||||
int user_alloc);
|
||||
gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
|
||||
struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
|
||||
void kvm_release_page_clean(struct page *page);
|
||||
void kvm_release_page_dirty(struct page *page);
|
||||
int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
|
||||
int len);
|
||||
int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
|
||||
unsigned long len);
|
||||
int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len);
|
||||
int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
|
||||
int offset, int len);
|
||||
int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
|
||||
unsigned long len);
|
||||
int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
|
||||
int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
|
||||
struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
|
||||
int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
|
||||
void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
|
||||
|
||||
void kvm_vcpu_block(struct kvm_vcpu *vcpu);
|
||||
void kvm_resched(struct kvm_vcpu *vcpu);
|
||||
void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
|
||||
void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
|
||||
void kvm_flush_remote_tlbs(struct kvm *kvm);
|
||||
|
||||
long kvm_arch_dev_ioctl(struct file *filp,
|
||||
unsigned int ioctl, unsigned long arg);
|
||||
long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
unsigned int ioctl, unsigned long arg);
|
||||
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
|
||||
void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
|
||||
|
||||
int kvm_dev_ioctl_check_extension(long ext);
|
||||
|
||||
int kvm_get_dirty_log(struct kvm *kvm,
|
||||
struct kvm_dirty_log *log, int *is_dirty);
|
||||
int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
|
||||
struct kvm_dirty_log *log);
|
||||
|
||||
int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
|
||||
struct
|
||||
kvm_userspace_memory_region *mem,
|
||||
int user_alloc);
|
||||
long kvm_arch_vm_ioctl(struct file *filp,
|
||||
unsigned int ioctl, unsigned long arg);
|
||||
void kvm_arch_destroy_vm(struct kvm *kvm);
|
||||
|
||||
int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
|
||||
int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
|
||||
|
||||
int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
|
||||
struct kvm_translation *tr);
|
||||
|
||||
int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs);
|
||||
int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs);
|
||||
int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
|
||||
struct kvm_sregs *sregs);
|
||||
int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
|
||||
struct kvm_sregs *sregs);
|
||||
int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
|
||||
struct kvm_debug_guest *dbg);
|
||||
int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
|
||||
|
||||
int kvm_arch_init(void *opaque);
|
||||
void kvm_arch_exit(void);
|
||||
|
||||
int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
|
||||
void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
|
||||
|
||||
void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
|
||||
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
|
||||
void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
|
||||
struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id);
|
||||
int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
|
||||
void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
|
||||
|
||||
int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
|
||||
void kvm_arch_hardware_enable(void *garbage);
|
||||
void kvm_arch_hardware_disable(void *garbage);
|
||||
int kvm_arch_hardware_setup(void);
|
||||
void kvm_arch_hardware_unsetup(void);
|
||||
void kvm_arch_check_processor_compat(void *rtn);
|
||||
int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
|
||||
|
||||
void kvm_free_physmem(struct kvm *kvm);
|
||||
|
||||
struct kvm *kvm_arch_create_vm(void);
|
||||
void kvm_arch_destroy_vm(struct kvm *kvm);
|
||||
|
||||
int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
|
||||
int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
|
||||
void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
|
||||
|
||||
static inline void kvm_guest_enter(void)
|
||||
{
|
||||
account_system_vtime(current);
|
||||
current->flags |= PF_VCPU;
|
||||
}
|
||||
|
||||
static inline void kvm_guest_exit(void)
|
||||
{
|
||||
account_system_vtime(current);
|
||||
current->flags &= ~PF_VCPU;
|
||||
}
|
||||
|
||||
static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot)
|
||||
{
|
||||
return slot - kvm->memslots;
|
||||
}
|
||||
|
||||
static inline gpa_t gfn_to_gpa(gfn_t gfn)
|
||||
{
|
||||
return (gpa_t)gfn << PAGE_SHIFT;
|
||||
}
|
||||
|
||||
static inline void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
|
||||
}
|
||||
|
||||
enum kvm_stat_kind {
|
||||
KVM_STAT_VM,
|
||||
KVM_STAT_VCPU,
|
||||
};
|
||||
|
||||
struct kvm_stats_debugfs_item {
|
||||
const char *name;
|
||||
int offset;
|
||||
enum kvm_stat_kind kind;
|
||||
struct dentry *dentry;
|
||||
};
|
||||
extern struct kvm_stats_debugfs_item debugfs_entries[];
|
||||
|
||||
#endif
|
@@ -2,72 +2,30 @@
|
||||
#define __LINUX_KVM_PARA_H
|
||||
|
||||
/*
|
||||
* Guest OS interface for KVM paravirtualization
|
||||
*
|
||||
* Note: this interface is totally experimental, and is certain to change
|
||||
* as we make progress.
|
||||
* This header file provides a method for making a hypercall to the host
|
||||
* Architectures should define:
|
||||
* - kvm_hypercall0, kvm_hypercall1...
|
||||
* - kvm_arch_para_features
|
||||
* - kvm_para_available
|
||||
*/
|
||||
|
||||
/* Return values for hypercalls */
|
||||
#define KVM_ENOSYS 1000
|
||||
|
||||
#define KVM_HC_VAPIC_POLL_IRQ 1
|
||||
|
||||
/*
|
||||
* Per-VCPU descriptor area shared between guest and host. Writable to
|
||||
* both guest and host. Registered with the host by the guest when
|
||||
* a guest acknowledges paravirtual mode.
|
||||
*
|
||||
* NOTE: all addresses are guest-physical addresses (gpa), to make it
|
||||
* easier for the hypervisor to map between the various addresses.
|
||||
* hypercalls use architecture specific
|
||||
*/
|
||||
struct kvm_vcpu_para_state {
|
||||
/*
|
||||
* API version information for compatibility. If there's any support
|
||||
* mismatch (too old host trying to execute too new guest) then
|
||||
* the host will deny entry into paravirtual mode. Any other
|
||||
* combination (new host + old guest and new host + new guest)
|
||||
* is supposed to work - new host versions will support all old
|
||||
* guest API versions.
|
||||
*/
|
||||
u32 guest_version;
|
||||
u32 host_version;
|
||||
u32 size;
|
||||
u32 ret;
|
||||
#include <asm/kvm_para.h>
|
||||
|
||||
/*
|
||||
* The address of the vm exit instruction (VMCALL or VMMCALL),
|
||||
* which the host will patch according to the CPU model the
|
||||
* VM runs on:
|
||||
*/
|
||||
u64 hypercall_gpa;
|
||||
#ifdef __KERNEL__
|
||||
static inline int kvm_para_has_feature(unsigned int feature)
|
||||
{
|
||||
if (kvm_arch_para_features() & (1UL << feature))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* __LINUX_KVM_PARA_H */
|
||||
|
||||
} __attribute__ ((aligned(PAGE_SIZE)));
|
||||
|
||||
#define KVM_PARA_API_VERSION 1
|
||||
|
||||
/*
|
||||
* This is used for an RDMSR's ECX parameter to probe for a KVM host.
|
||||
* Hopefully no CPU vendor will use up this number. This is placed well
|
||||
* out of way of the typical space occupied by CPU vendors' MSR indices,
|
||||
* and we think (or at least hope) it wont be occupied in the future
|
||||
* either.
|
||||
*/
|
||||
#define MSR_KVM_API_MAGIC 0x87655678
|
||||
|
||||
#define KVM_EINVAL 1
|
||||
|
||||
/*
|
||||
* Hypercall calling convention:
|
||||
*
|
||||
* Each hypercall may have 0-6 parameters.
|
||||
*
|
||||
* 64-bit hypercall index is in RAX, goes from 0 to __NR_hypercalls-1
|
||||
*
|
||||
* 64-bit parameters 1-6 are in the standard gcc x86_64 calling convention
|
||||
* order: RDI, RSI, RDX, RCX, R8, R9.
|
||||
*
|
||||
* 32-bit index is EBX, parameters are: EAX, ECX, EDX, ESI, EDI, EBP.
|
||||
* (the first 3 are according to the gcc regparm calling convention)
|
||||
*
|
||||
* No registers are clobbered by the hypercall, except that the
|
||||
* return value is in RAX.
|
||||
*/
|
||||
#define __NR_hypercalls 0
|
||||
|
||||
#endif
|
||||
|
54
include/linux/kvm_types.h
Normal file
54
include/linux/kvm_types.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __KVM_TYPES_H__
|
||||
#define __KVM_TYPES_H__
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
/*
|
||||
* Address types:
|
||||
*
|
||||
* gva - guest virtual address
|
||||
* gpa - guest physical address
|
||||
* gfn - guest frame number
|
||||
* hva - host virtual address
|
||||
* hpa - host physical address
|
||||
* hfn - host frame number
|
||||
*/
|
||||
|
||||
typedef unsigned long gva_t;
|
||||
typedef u64 gpa_t;
|
||||
typedef unsigned long gfn_t;
|
||||
|
||||
typedef unsigned long hva_t;
|
||||
typedef u64 hpa_t;
|
||||
typedef unsigned long hfn_t;
|
||||
|
||||
struct kvm_pio_request {
|
||||
unsigned long count;
|
||||
int cur_count;
|
||||
struct page *guest_pages[2];
|
||||
unsigned guest_page_offset;
|
||||
int in;
|
||||
int port;
|
||||
int size;
|
||||
int string;
|
||||
int down;
|
||||
int rep;
|
||||
};
|
||||
|
||||
#endif /* __KVM_TYPES_H__ */
|
44
include/linux/latencytop.h
Normal file
44
include/linux/latencytop.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* latencytop.h: Infrastructure for displaying latency
|
||||
*
|
||||
* (C) Copyright 2008 Intel Corporation
|
||||
* Author: Arjan van de Ven <arjan@linux.intel.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_GUARD_LATENCYTOP_H_
|
||||
#define _INCLUDE_GUARD_LATENCYTOP_H_
|
||||
|
||||
#ifdef CONFIG_LATENCYTOP
|
||||
|
||||
#define LT_SAVECOUNT 32
|
||||
#define LT_BACKTRACEDEPTH 12
|
||||
|
||||
struct latency_record {
|
||||
unsigned long backtrace[LT_BACKTRACEDEPTH];
|
||||
unsigned int count;
|
||||
unsigned long time;
|
||||
unsigned long max;
|
||||
};
|
||||
|
||||
|
||||
struct task_struct;
|
||||
|
||||
void account_scheduler_latency(struct task_struct *task, int usecs, int inter);
|
||||
|
||||
void clear_all_latency_tracing(struct task_struct *p);
|
||||
|
||||
#else
|
||||
|
||||
static inline void
|
||||
account_scheduler_latency(struct task_struct *task, int usecs, int inter)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void clear_all_latency_tracing(struct task_struct *p)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -35,6 +35,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <scsi/scsi_host.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/cdrom.h>
|
||||
|
||||
/*
|
||||
* Define if arch has non-standard setup. This is a _PCI_ standard
|
||||
@@ -143,10 +144,11 @@ enum {
|
||||
ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
|
||||
ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
|
||||
ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
|
||||
ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
|
||||
ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
|
||||
ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
|
||||
|
||||
ATA_DFLAG_DETACH = (1 << 16),
|
||||
ATA_DFLAG_DETACHED = (1 << 17),
|
||||
ATA_DFLAG_DETACH = (1 << 24),
|
||||
ATA_DFLAG_DETACHED = (1 << 25),
|
||||
|
||||
ATA_DEV_UNKNOWN = 0, /* unknown device */
|
||||
ATA_DEV_ATA = 1, /* ATA device */
|
||||
@@ -217,9 +219,7 @@ enum {
|
||||
|
||||
/* struct ata_queued_cmd flags */
|
||||
ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
|
||||
ATA_QCFLAG_SG = (1 << 1), /* have s/g table? */
|
||||
ATA_QCFLAG_SINGLE = (1 << 2), /* no s/g, just a single buffer */
|
||||
ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
|
||||
ATA_QCFLAG_DMAMAP = (1 << 1), /* SG table is DMA mapped */
|
||||
ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
|
||||
ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
|
||||
ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
|
||||
@@ -266,19 +266,15 @@ enum {
|
||||
PORT_DISABLED = 2,
|
||||
|
||||
/* encoding various smaller bitmaps into a single
|
||||
* unsigned int bitmap
|
||||
* unsigned long bitmap
|
||||
*/
|
||||
ATA_BITS_PIO = 7,
|
||||
ATA_BITS_MWDMA = 5,
|
||||
ATA_BITS_UDMA = 8,
|
||||
ATA_NR_PIO_MODES = 7,
|
||||
ATA_NR_MWDMA_MODES = 5,
|
||||
ATA_NR_UDMA_MODES = 8,
|
||||
|
||||
ATA_SHIFT_PIO = 0,
|
||||
ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_BITS_PIO,
|
||||
ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_BITS_MWDMA,
|
||||
|
||||
ATA_MASK_PIO = ((1 << ATA_BITS_PIO) - 1) << ATA_SHIFT_PIO,
|
||||
ATA_MASK_MWDMA = ((1 << ATA_BITS_MWDMA) - 1) << ATA_SHIFT_MWDMA,
|
||||
ATA_MASK_UDMA = ((1 << ATA_BITS_UDMA) - 1) << ATA_SHIFT_UDMA,
|
||||
ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES,
|
||||
ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES,
|
||||
|
||||
/* size of buffer to pad xfers ending on unaligned boundaries */
|
||||
ATA_DMA_PAD_SZ = 4,
|
||||
@@ -349,6 +345,21 @@ enum {
|
||||
ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */
|
||||
ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */
|
||||
ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */
|
||||
|
||||
/* ATAPI command types */
|
||||
ATAPI_READ = 0, /* READs */
|
||||
ATAPI_WRITE = 1, /* WRITEs */
|
||||
ATAPI_READ_CD = 2, /* READ CD [MSF] */
|
||||
ATAPI_MISC = 3, /* the rest */
|
||||
};
|
||||
|
||||
enum ata_xfer_mask {
|
||||
ATA_MASK_PIO = ((1LU << ATA_NR_PIO_MODES) - 1)
|
||||
<< ATA_SHIFT_PIO,
|
||||
ATA_MASK_MWDMA = ((1LU << ATA_NR_MWDMA_MODES) - 1)
|
||||
<< ATA_SHIFT_MWDMA,
|
||||
ATA_MASK_UDMA = ((1LU << ATA_NR_UDMA_MODES) - 1)
|
||||
<< ATA_SHIFT_UDMA,
|
||||
};
|
||||
|
||||
enum hsm_task_states {
|
||||
@@ -447,7 +458,7 @@ struct ata_queued_cmd {
|
||||
unsigned int tag;
|
||||
unsigned int n_elem;
|
||||
unsigned int n_iter;
|
||||
unsigned int orig_n_elem;
|
||||
unsigned int mapped_n_elem;
|
||||
|
||||
int dma_dir;
|
||||
|
||||
@@ -455,17 +466,18 @@ struct ata_queued_cmd {
|
||||
unsigned int sect_size;
|
||||
|
||||
unsigned int nbytes;
|
||||
unsigned int raw_nbytes;
|
||||
unsigned int curbytes;
|
||||
|
||||
struct scatterlist *cursg;
|
||||
unsigned int cursg_ofs;
|
||||
|
||||
struct scatterlist *last_sg;
|
||||
struct scatterlist saved_last_sg;
|
||||
struct scatterlist sgent;
|
||||
struct scatterlist pad_sgent;
|
||||
void *buf_virt;
|
||||
struct scatterlist extra_sg[2];
|
||||
|
||||
/* DO NOT iterate over __sg manually, use ata_for_each_sg() */
|
||||
struct scatterlist *__sg;
|
||||
struct scatterlist *sg;
|
||||
|
||||
unsigned int err_mask;
|
||||
struct ata_taskfile result_tf;
|
||||
@@ -482,7 +494,7 @@ struct ata_port_stats {
|
||||
};
|
||||
|
||||
struct ata_ering_entry {
|
||||
int is_io;
|
||||
unsigned int eflags;
|
||||
unsigned int err_mask;
|
||||
u64 timestamp;
|
||||
};
|
||||
@@ -522,9 +534,9 @@ struct ata_device {
|
||||
unsigned int cdb_len;
|
||||
|
||||
/* per-dev xfer mask */
|
||||
unsigned int pio_mask;
|
||||
unsigned int mwdma_mask;
|
||||
unsigned int udma_mask;
|
||||
unsigned long pio_mask;
|
||||
unsigned long mwdma_mask;
|
||||
unsigned long udma_mask;
|
||||
|
||||
/* for CHS addressing */
|
||||
u16 cylinders; /* Number of cylinders */
|
||||
@@ -560,6 +572,8 @@ struct ata_eh_context {
|
||||
int tries[ATA_MAX_DEVICES];
|
||||
unsigned int classes[ATA_MAX_DEVICES];
|
||||
unsigned int did_probe_mask;
|
||||
unsigned int saved_ncq_enabled;
|
||||
u8 saved_xfer_mode[ATA_MAX_DEVICES];
|
||||
};
|
||||
|
||||
struct ata_acpi_drive
|
||||
@@ -686,7 +700,8 @@ struct ata_port_operations {
|
||||
void (*bmdma_setup) (struct ata_queued_cmd *qc);
|
||||
void (*bmdma_start) (struct ata_queued_cmd *qc);
|
||||
|
||||
void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int);
|
||||
unsigned int (*data_xfer) (struct ata_device *dev, unsigned char *buf,
|
||||
unsigned int buflen, int rw);
|
||||
|
||||
int (*qc_defer) (struct ata_queued_cmd *qc);
|
||||
void (*qc_prep) (struct ata_queued_cmd *qc);
|
||||
@@ -832,8 +847,6 @@ extern int ata_busy_sleep(struct ata_port *ap,
|
||||
unsigned long timeout_pat, unsigned long timeout);
|
||||
extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline);
|
||||
extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline);
|
||||
extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
|
||||
void *data, unsigned long delay);
|
||||
extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
|
||||
unsigned long interval_msec,
|
||||
unsigned long timeout_msec);
|
||||
@@ -848,6 +861,16 @@ extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
|
||||
extern void ata_tf_to_fis(const struct ata_taskfile *tf,
|
||||
u8 pmp, int is_cmd, u8 *fis);
|
||||
extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
|
||||
extern unsigned long ata_pack_xfermask(unsigned long pio_mask,
|
||||
unsigned long mwdma_mask, unsigned long udma_mask);
|
||||
extern void ata_unpack_xfermask(unsigned long xfer_mask,
|
||||
unsigned long *pio_mask, unsigned long *mwdma_mask,
|
||||
unsigned long *udma_mask);
|
||||
extern u8 ata_xfer_mask2mode(unsigned long xfer_mask);
|
||||
extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
|
||||
extern int ata_xfer_mode2shift(unsigned long xfer_mode);
|
||||
extern const char *ata_mode_string(unsigned long xfer_mask);
|
||||
extern unsigned long ata_id_xfermask(const u16 *id);
|
||||
extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device);
|
||||
extern void ata_std_dev_select(struct ata_port *ap, unsigned int device);
|
||||
extern u8 ata_check_status(struct ata_port *ap);
|
||||
@@ -856,17 +879,15 @@ extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
|
||||
extern int ata_port_start(struct ata_port *ap);
|
||||
extern int ata_sff_port_start(struct ata_port *ap);
|
||||
extern irqreturn_t ata_interrupt(int irq, void *dev_instance);
|
||||
extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf,
|
||||
unsigned int buflen, int write_data);
|
||||
extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf,
|
||||
unsigned int buflen, int write_data);
|
||||
extern unsigned int ata_data_xfer(struct ata_device *dev,
|
||||
unsigned char *buf, unsigned int buflen, int rw);
|
||||
extern unsigned int ata_data_xfer_noirq(struct ata_device *dev,
|
||||
unsigned char *buf, unsigned int buflen, int rw);
|
||||
extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
|
||||
extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
|
||||
extern void ata_qc_prep(struct ata_queued_cmd *qc);
|
||||
extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
|
||||
extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
|
||||
extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
|
||||
unsigned int buflen);
|
||||
extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
|
||||
unsigned int n_elem);
|
||||
extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
|
||||
@@ -875,7 +896,6 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
|
||||
unsigned int ofs, unsigned int len);
|
||||
extern void ata_id_c_string(const u16 *id, unsigned char *s,
|
||||
unsigned int ofs, unsigned int len);
|
||||
extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown);
|
||||
extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
|
||||
extern void ata_bmdma_start(struct ata_queued_cmd *qc);
|
||||
extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
|
||||
@@ -910,6 +930,7 @@ extern u8 ata_irq_on(struct ata_port *ap);
|
||||
extern int ata_cable_40wire(struct ata_port *ap);
|
||||
extern int ata_cable_80wire(struct ata_port *ap);
|
||||
extern int ata_cable_sata(struct ata_port *ap);
|
||||
extern int ata_cable_ignore(struct ata_port *ap);
|
||||
extern int ata_cable_unknown(struct ata_port *ap);
|
||||
|
||||
/*
|
||||
@@ -917,11 +938,13 @@ extern int ata_cable_unknown(struct ata_port *ap);
|
||||
*/
|
||||
|
||||
extern unsigned int ata_pio_need_iordy(const struct ata_device *);
|
||||
extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
|
||||
extern int ata_timing_compute(struct ata_device *, unsigned short,
|
||||
struct ata_timing *, int, int);
|
||||
extern void ata_timing_merge(const struct ata_timing *,
|
||||
const struct ata_timing *, struct ata_timing *,
|
||||
unsigned int);
|
||||
extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle);
|
||||
|
||||
enum {
|
||||
ATA_TIMING_SETUP = (1 << 0),
|
||||
@@ -948,15 +971,40 @@ static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
|
||||
return &ap->__acpi_init_gtm;
|
||||
return NULL;
|
||||
}
|
||||
extern int ata_acpi_cbl_80wire(struct ata_port *ap);
|
||||
int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
|
||||
int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
|
||||
unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev,
|
||||
const struct ata_acpi_gtm *gtm);
|
||||
int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm);
|
||||
#else
|
||||
static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
|
||||
|
||||
static inline int ata_acpi_stm(const struct ata_port *ap,
|
||||
struct ata_acpi_gtm *stm)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline int ata_acpi_gtm(const struct ata_port *ap,
|
||||
struct ata_acpi_gtm *stm)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev,
|
||||
const struct ata_acpi_gtm *gtm)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
|
||||
const struct ata_acpi_gtm *gtm)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
@@ -985,8 +1033,12 @@ extern int ata_pci_init_bmdma(struct ata_host *host);
|
||||
extern int ata_pci_prepare_sff_host(struct pci_dev *pdev,
|
||||
const struct ata_port_info * const * ppi,
|
||||
struct ata_host **r_host);
|
||||
extern int ata_pci_activate_sff_host(struct ata_host *host,
|
||||
irq_handler_t irq_handler,
|
||||
struct scsi_host_template *sht);
|
||||
extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
|
||||
extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
|
||||
extern unsigned long ata_pci_default_filter(struct ata_device *dev,
|
||||
unsigned long xfer_mask);
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
/*
|
||||
@@ -1074,35 +1126,6 @@ extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
|
||||
const char *name);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* qc helpers
|
||||
*/
|
||||
static inline struct scatterlist *
|
||||
ata_qc_first_sg(struct ata_queued_cmd *qc)
|
||||
{
|
||||
qc->n_iter = 0;
|
||||
if (qc->n_elem)
|
||||
return qc->__sg;
|
||||
if (qc->pad_len)
|
||||
return &qc->pad_sgent;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct scatterlist *
|
||||
ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
|
||||
{
|
||||
if (sg == &qc->pad_sgent)
|
||||
return NULL;
|
||||
if (++qc->n_iter < qc->n_elem)
|
||||
return sg_next(sg);
|
||||
if (qc->pad_len)
|
||||
return &qc->pad_sgent;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define ata_for_each_sg(sg, qc) \
|
||||
for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc))
|
||||
|
||||
static inline unsigned int ata_tag_valid(unsigned int tag)
|
||||
{
|
||||
return (tag < ATA_MAX_QUEUE) ? 1 : 0;
|
||||
@@ -1337,15 +1360,17 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
|
||||
static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
|
||||
{
|
||||
qc->dma_dir = DMA_NONE;
|
||||
qc->__sg = NULL;
|
||||
qc->sg = NULL;
|
||||
qc->flags = 0;
|
||||
qc->cursg = NULL;
|
||||
qc->cursg_ofs = 0;
|
||||
qc->nbytes = qc->curbytes = 0;
|
||||
qc->nbytes = qc->raw_nbytes = qc->curbytes = 0;
|
||||
qc->n_elem = 0;
|
||||
qc->mapped_n_elem = 0;
|
||||
qc->n_iter = 0;
|
||||
qc->err_mask = 0;
|
||||
qc->pad_len = 0;
|
||||
qc->last_sg = NULL;
|
||||
qc->sect_size = ATA_SECT_SIZE;
|
||||
|
||||
ata_tf_init(qc->dev, &qc->tf);
|
||||
@@ -1362,6 +1387,27 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
|
||||
ata_id_has_flush_ext(dev->id);
|
||||
}
|
||||
|
||||
static inline int atapi_cmd_type(u8 opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case GPCMD_READ_10:
|
||||
case GPCMD_READ_12:
|
||||
return ATAPI_READ;
|
||||
|
||||
case GPCMD_WRITE_10:
|
||||
case GPCMD_WRITE_12:
|
||||
case GPCMD_WRITE_AND_VERIFY_10:
|
||||
return ATAPI_WRITE;
|
||||
|
||||
case GPCMD_READ_CD:
|
||||
case GPCMD_READ_CD_MSF:
|
||||
return ATAPI_READ_CD;
|
||||
|
||||
default:
|
||||
return ATAPI_MISC;
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned int ac_err_mask(u8 status)
|
||||
{
|
||||
if (status & (ATA_BUSY | ATA_DRQ))
|
||||
|
@@ -13,6 +13,10 @@
|
||||
#define asmlinkage CPP_ASMLINKAGE
|
||||
#endif
|
||||
|
||||
#ifndef asmregparm
|
||||
# define asmregparm
|
||||
#endif
|
||||
|
||||
#ifndef prevent_tail_call
|
||||
# define prevent_tail_call(ret) do { } while (0)
|
||||
#endif
|
||||
@@ -53,6 +57,10 @@
|
||||
.size name, .-name
|
||||
#endif
|
||||
|
||||
/* If symbol 'name' is treated as a subroutine (gets called, and returns)
|
||||
* then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
|
||||
* static analysis tools such as stack depth analyzer.
|
||||
*/
|
||||
#ifndef ENDPROC
|
||||
#define ENDPROC(name) \
|
||||
.type name, @function; \
|
||||
|
@@ -32,10 +32,27 @@ struct nlmsvc_binding {
|
||||
|
||||
extern struct nlmsvc_binding * nlmsvc_ops;
|
||||
|
||||
/*
|
||||
* Similar to nfs_client_initdata, but without the NFS-specific
|
||||
* rpc_ops field.
|
||||
*/
|
||||
struct nlmclnt_initdata {
|
||||
const char *hostname;
|
||||
const struct sockaddr *address;
|
||||
size_t addrlen;
|
||||
unsigned short protocol;
|
||||
u32 nfs_version;
|
||||
};
|
||||
|
||||
/*
|
||||
* Functions exported by the lockd module
|
||||
*/
|
||||
extern int nlmclnt_proc(struct inode *, int, struct file_lock *);
|
||||
|
||||
extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
|
||||
extern void nlmclnt_done(struct nlm_host *host);
|
||||
|
||||
extern int nlmclnt_proc(struct nlm_host *host, int cmd,
|
||||
struct file_lock *fl);
|
||||
extern int lockd_up(int proto);
|
||||
extern void lockd_down(void);
|
||||
|
||||
|
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Definitions for the ST M41T00 family of i2c rtc chips.
|
||||
*
|
||||
* Author: Mark A. Greer <mgreer@mvista.com>
|
||||
*
|
||||
* 2005, 2006 (c) MontaVista Software, Inc. This file is licensed under
|
||||
* the terms of the GNU General Public License version 2. This program
|
||||
* is licensed "as is" without any warranty of any kind, whether express
|
||||
* or implied.
|
||||
*/
|
||||
|
||||
#ifndef _M41T00_H
|
||||
#define _M41T00_H
|
||||
|
||||
#define M41T00_DRV_NAME "m41t00"
|
||||
#define M41T00_I2C_ADDR 0x68
|
||||
|
||||
#define M41T00_TYPE_M41T00 0
|
||||
#define M41T00_TYPE_M41T81 81
|
||||
#define M41T00_TYPE_M41T85 85
|
||||
|
||||
struct m41t00_platform_data {
|
||||
u8 type;
|
||||
u8 i2c_addr;
|
||||
u8 sqw_freq;
|
||||
};
|
||||
|
||||
/* SQW output disabled, this is default value by power on */
|
||||
#define M41T00_SQW_DISABLE (0)
|
||||
|
||||
#define M41T00_SQW_32KHZ (1<<4) /* 32.768 KHz */
|
||||
#define M41T00_SQW_8KHZ (2<<4) /* 8.192 KHz */
|
||||
#define M41T00_SQW_4KHZ (3<<4) /* 4.096 KHz */
|
||||
#define M41T00_SQW_2KHZ (4<<4) /* 2.048 KHz */
|
||||
#define M41T00_SQW_1KHZ (5<<4) /* 1.024 KHz */
|
||||
#define M41T00_SQW_512HZ (6<<4) /* 512 Hz */
|
||||
#define M41T00_SQW_256HZ (7<<4) /* 256 Hz */
|
||||
#define M41T00_SQW_128HZ (8<<4) /* 128 Hz */
|
||||
#define M41T00_SQW_64HZ (9<<4) /* 64 Hz */
|
||||
#define M41T00_SQW_32HZ (10<<4) /* 32 Hz */
|
||||
#define M41T00_SQW_16HZ (11<<4) /* 16 Hz */
|
||||
#define M41T00_SQW_8HZ (12<<4) /* 8 Hz */
|
||||
#define M41T00_SQW_4HZ (13<<4) /* 4 Hz */
|
||||
#define M41T00_SQW_2HZ (14<<4) /* 2 Hz */
|
||||
#define M41T00_SQW_1HZ (15<<4) /* 1 Hz */
|
||||
|
||||
extern ulong m41t00_get_rtc_time(void);
|
||||
extern int m41t00_set_rtc_time(ulong nowtime);
|
||||
|
||||
#endif /* _M41T00_H */
|
@@ -12,7 +12,6 @@
|
||||
#include <linux/prio_tree.h>
|
||||
#include <linux/debug_locks.h>
|
||||
#include <linux/mm_types.h>
|
||||
#include <linux/security.h>
|
||||
|
||||
struct mempolicy;
|
||||
struct anon_vma;
|
||||
@@ -34,6 +33,8 @@ extern int sysctl_legacy_va_layout;
|
||||
#define sysctl_legacy_va_layout 0
|
||||
#endif
|
||||
|
||||
extern unsigned long mmap_min_addr;
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/processor.h>
|
||||
@@ -1117,9 +1118,21 @@ static inline void vm_stat_account(struct mm_struct *mm,
|
||||
}
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
#ifndef CONFIG_DEBUG_PAGEALLOC
|
||||
#ifdef CONFIG_DEBUG_PAGEALLOC
|
||||
extern int debug_pagealloc_enabled;
|
||||
|
||||
extern void kernel_map_pages(struct page *page, int numpages, int enable);
|
||||
|
||||
static inline void enable_debug_pagealloc(void)
|
||||
{
|
||||
debug_pagealloc_enabled = 1;
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
kernel_map_pages(struct page *page, int numpages, int enable) {}
|
||||
static inline void enable_debug_pagealloc(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
|
||||
@@ -1145,6 +1158,7 @@ extern int randomize_va_space;
|
||||
#endif
|
||||
|
||||
const char * arch_vma_name(struct vm_area_struct *vma);
|
||||
void print_vma_addr(char *prefix, unsigned long rip);
|
||||
|
||||
struct page *sparse_mem_map_populate(unsigned long pnum, int nid);
|
||||
pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
|
||||
|
@@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol);
|
||||
#define __CRC_SYMBOL(sym, sec) \
|
||||
extern void *__crc_##sym __attribute__((weak)); \
|
||||
static const unsigned long __kcrctab_##sym \
|
||||
__attribute_used__ \
|
||||
__used \
|
||||
__attribute__((section("__kcrctab" sec), unused)) \
|
||||
= (unsigned long) &__crc_##sym;
|
||||
#else
|
||||
@@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol);
|
||||
__attribute__((section("__ksymtab_strings"))) \
|
||||
= MODULE_SYMBOL_PREFIX #sym; \
|
||||
static const struct kernel_symbol __ksymtab_##sym \
|
||||
__attribute_used__ \
|
||||
__used \
|
||||
__attribute__((section("__ksymtab" sec), unused)) \
|
||||
= { (unsigned long)&sym, __kstrtab_##sym }
|
||||
|
||||
@@ -446,11 +446,14 @@ static inline void __module_get(struct module *module)
|
||||
__mod ? __mod->name : "kernel"; \
|
||||
})
|
||||
|
||||
/* For kallsyms to ask for address resolution. NULL means not found. */
|
||||
const char *module_address_lookup(unsigned long addr,
|
||||
unsigned long *symbolsize,
|
||||
unsigned long *offset,
|
||||
char **modname);
|
||||
/* For kallsyms to ask for address resolution. namebuf should be at
|
||||
* least KSYM_NAME_LEN long: a pointer to namebuf is returned if
|
||||
* found, otherwise NULL. */
|
||||
char *module_address_lookup(unsigned long addr,
|
||||
unsigned long *symbolsize,
|
||||
unsigned long *offset,
|
||||
char **modname,
|
||||
char *namebuf);
|
||||
int lookup_module_symbol_name(unsigned long addr, char *symname);
|
||||
int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
|
||||
|
||||
@@ -516,10 +519,11 @@ static inline void module_put(struct module *module)
|
||||
#define module_name(mod) "kernel"
|
||||
|
||||
/* For kallsyms to ask for address resolution. NULL means not found. */
|
||||
static inline const char *module_address_lookup(unsigned long addr,
|
||||
unsigned long *symbolsize,
|
||||
unsigned long *offset,
|
||||
char **modname)
|
||||
static inline char *module_address_lookup(unsigned long addr,
|
||||
unsigned long *symbolsize,
|
||||
unsigned long *offset,
|
||||
char **modname,
|
||||
char *namebuf)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -574,7 +578,9 @@ struct device_driver;
|
||||
#ifdef CONFIG_SYSFS
|
||||
struct module;
|
||||
|
||||
extern struct kset module_subsys;
|
||||
extern struct kset *module_kset;
|
||||
extern struct kobj_type module_ktype;
|
||||
extern int module_sysfs_initialized;
|
||||
|
||||
int mod_sysfs_init(struct module *mod);
|
||||
int mod_sysfs_setup(struct module *mod,
|
||||
@@ -607,21 +613,6 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
|
||||
|
||||
#endif /* CONFIG_SYSFS */
|
||||
|
||||
#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
|
||||
|
||||
void module_add_driver(struct module *mod, struct device_driver *drv);
|
||||
void module_remove_driver(struct device_driver *drv);
|
||||
|
||||
#else /* not both CONFIG_SYSFS && CONFIG_MODULES */
|
||||
|
||||
static inline void module_add_driver(struct module *mod, struct device_driver *drv)
|
||||
{ }
|
||||
|
||||
static inline void module_remove_driver(struct device_driver *drv)
|
||||
{ }
|
||||
|
||||
#endif
|
||||
|
||||
#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
|
||||
|
||||
/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#define __module_cat(a,b) ___module_cat(a,b)
|
||||
#define __MODULE_INFO(tag, name, info) \
|
||||
static const char __module_cat(name,__LINE__)[] \
|
||||
__attribute_used__ \
|
||||
__used \
|
||||
__attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
|
||||
#else /* !MODULE */
|
||||
#define __MODULE_INFO(tag, name, info)
|
||||
@@ -72,7 +72,7 @@ struct kparam_array
|
||||
BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
|
||||
static const char __param_str_##name[] = prefix #name; \
|
||||
static struct kernel_param const __param_##name \
|
||||
__attribute_used__ \
|
||||
__used \
|
||||
__attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
|
||||
= { __param_str_##name, perm, set, get, { arg } }
|
||||
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <linux/mv643xx_eth.h>
|
||||
#include <linux/mv643xx_i2c.h>
|
||||
|
||||
/****************************************/
|
||||
/* Processor Address Space */
|
||||
@@ -863,7 +864,6 @@
|
||||
/* I2C Registers */
|
||||
/****************************************/
|
||||
|
||||
#define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c"
|
||||
#define MV64XXX_I2C_OFFSET 0xc000
|
||||
#define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020
|
||||
|
||||
@@ -968,14 +968,6 @@ struct mpsc_pdata {
|
||||
u32 brg_clk_freq;
|
||||
};
|
||||
|
||||
/* i2c Platform Device, Driver Data */
|
||||
struct mv64xxx_i2c_pdata {
|
||||
u32 freq_m;
|
||||
u32 freq_n;
|
||||
u32 timeout; /* In milliseconds */
|
||||
u32 retries;
|
||||
};
|
||||
|
||||
/* Watchdog Platform Device, Driver Data */
|
||||
#define MV64x60_WDT_NAME "mv64x60_wdt"
|
||||
|
||||
|
22
include/linux/mv643xx_i2c.h
Normal file
22
include/linux/mv643xx_i2c.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef _MV64XXX_I2C_H_
|
||||
#define _MV64XXX_I2C_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c"
|
||||
|
||||
/* i2c Platform Device, Driver Data */
|
||||
struct mv64xxx_i2c_pdata {
|
||||
u32 freq_m;
|
||||
u32 freq_n;
|
||||
u32 timeout; /* In milliseconds */
|
||||
};
|
||||
|
||||
#endif /*_MV64XXX_I2C_H_*/
|
@@ -22,6 +22,7 @@
|
||||
#include <asm/socket.h>
|
||||
|
||||
struct poll_table_struct;
|
||||
struct pipe_inode_info;
|
||||
struct inode;
|
||||
struct net;
|
||||
|
||||
@@ -172,6 +173,8 @@ struct proto_ops {
|
||||
struct vm_area_struct * vma);
|
||||
ssize_t (*sendpage) (struct socket *sock, struct page *page,
|
||||
int offset, size_t size, int flags);
|
||||
ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
|
||||
struct pipe_inode_info *pipe, size_t len, unsigned int flags);
|
||||
};
|
||||
|
||||
struct net_proto_family {
|
||||
@@ -183,6 +186,13 @@ struct net_proto_family {
|
||||
struct iovec;
|
||||
struct kvec;
|
||||
|
||||
enum {
|
||||
SOCK_WAKE_IO,
|
||||
SOCK_WAKE_WAITD,
|
||||
SOCK_WAKE_SPACE,
|
||||
SOCK_WAKE_URG,
|
||||
};
|
||||
|
||||
extern int sock_wake_async(struct socket *sk, int how, int band);
|
||||
extern int sock_register(const struct net_proto_family *fam);
|
||||
extern void sock_unregister(int family);
|
||||
@@ -327,7 +337,6 @@ static const struct proto_ops name##_ops = { \
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
#include <linux/sysctl.h>
|
||||
extern ctl_table net_table[];
|
||||
extern int net_msg_cost;
|
||||
extern int net_msg_burst;
|
||||
#endif
|
||||
|
@@ -7,6 +7,8 @@
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/list.h>
|
||||
#endif
|
||||
@@ -39,6 +41,23 @@
|
||||
#define NFC_ALTERED 0x8000
|
||||
#endif
|
||||
|
||||
enum nf_inet_hooks {
|
||||
NF_INET_PRE_ROUTING,
|
||||
NF_INET_LOCAL_IN,
|
||||
NF_INET_FORWARD,
|
||||
NF_INET_LOCAL_OUT,
|
||||
NF_INET_POST_ROUTING,
|
||||
NF_INET_NUMHOOKS
|
||||
};
|
||||
|
||||
union nf_inet_addr {
|
||||
u_int32_t all[4];
|
||||
__be32 ip;
|
||||
__be32 ip6[4];
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifdef CONFIG_NETFILTER
|
||||
|
||||
@@ -92,19 +111,6 @@ struct nf_sockopt_ops
|
||||
struct module *owner;
|
||||
};
|
||||
|
||||
/* Each queued (to userspace) skbuff has one of these. */
|
||||
struct nf_info
|
||||
{
|
||||
/* The ops struct which sent us to userspace. */
|
||||
struct nf_hook_ops *elem;
|
||||
|
||||
/* If we're sent to userspace, this keeps housekeeping info */
|
||||
int pf;
|
||||
unsigned int hook;
|
||||
struct net_device *indev, *outdev;
|
||||
int (*okfn)(struct sk_buff *);
|
||||
};
|
||||
|
||||
/* Function to register/unregister hook points. */
|
||||
int nf_register_hook(struct nf_hook_ops *reg);
|
||||
void nf_unregister_hook(struct nf_hook_ops *reg);
|
||||
@@ -118,71 +124,12 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
/* Sysctl registration */
|
||||
struct ctl_table_header *nf_register_sysctl_table(struct ctl_table *path,
|
||||
struct ctl_table *table);
|
||||
void nf_unregister_sysctl_table(struct ctl_table_header *header,
|
||||
struct ctl_table *table);
|
||||
extern struct ctl_table nf_net_netfilter_sysctl_path[];
|
||||
extern struct ctl_table nf_net_ipv4_netfilter_sysctl_path[];
|
||||
extern struct ctl_path nf_net_netfilter_sysctl_path[];
|
||||
extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
|
||||
|
||||
/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
|
||||
* disappear once iptables is replaced with pkttables. Please DO NOT use them
|
||||
* for any new code! */
|
||||
#define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
|
||||
#define NF_LOG_TCPOPT 0x02 /* Log TCP options */
|
||||
#define NF_LOG_IPOPT 0x04 /* Log IP options */
|
||||
#define NF_LOG_UID 0x08 /* Log UID owning local socket */
|
||||
#define NF_LOG_MASK 0x0f
|
||||
|
||||
#define NF_LOG_TYPE_LOG 0x01
|
||||
#define NF_LOG_TYPE_ULOG 0x02
|
||||
|
||||
struct nf_loginfo {
|
||||
u_int8_t type;
|
||||
union {
|
||||
struct {
|
||||
u_int32_t copy_len;
|
||||
u_int16_t group;
|
||||
u_int16_t qthreshold;
|
||||
} ulog;
|
||||
struct {
|
||||
u_int8_t level;
|
||||
u_int8_t logflags;
|
||||
} log;
|
||||
} u;
|
||||
};
|
||||
|
||||
typedef void nf_logfn(unsigned int pf,
|
||||
unsigned int hooknum,
|
||||
const struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
const struct nf_loginfo *li,
|
||||
const char *prefix);
|
||||
|
||||
struct nf_logger {
|
||||
struct module *me;
|
||||
nf_logfn *logfn;
|
||||
char *name;
|
||||
};
|
||||
|
||||
/* Function to register/unregister log function. */
|
||||
int nf_log_register(int pf, struct nf_logger *logger);
|
||||
void nf_log_unregister(struct nf_logger *logger);
|
||||
void nf_log_unregister_pf(int pf);
|
||||
|
||||
/* Calls the registered backend logging function */
|
||||
void nf_log_packet(int pf,
|
||||
unsigned int hooknum,
|
||||
const struct sk_buff *skb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
struct nf_loginfo *li,
|
||||
const char *fmt, ...);
|
||||
|
||||
int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
|
||||
struct net_device *indev, struct net_device *outdev,
|
||||
int (*okfn)(struct sk_buff *), int thresh);
|
||||
@@ -265,65 +212,28 @@ int compat_nf_setsockopt(struct sock *sk, int pf, int optval,
|
||||
int compat_nf_getsockopt(struct sock *sk, int pf, int optval,
|
||||
char __user *opt, int *len);
|
||||
|
||||
/* Packet queuing */
|
||||
struct nf_queue_handler {
|
||||
int (*outfn)(struct sk_buff *skb, struct nf_info *info,
|
||||
unsigned int queuenum, void *data);
|
||||
void *data;
|
||||
char *name;
|
||||
};
|
||||
extern int nf_register_queue_handler(int pf,
|
||||
struct nf_queue_handler *qh);
|
||||
extern int nf_unregister_queue_handler(int pf,
|
||||
struct nf_queue_handler *qh);
|
||||
extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh);
|
||||
extern void nf_reinject(struct sk_buff *skb,
|
||||
struct nf_info *info,
|
||||
unsigned int verdict);
|
||||
|
||||
/* FIXME: Before cache is ever used, this must be implemented for real. */
|
||||
extern void nf_invalidate_cache(int pf);
|
||||
|
||||
/* Call this before modifying an existing packet: ensures it is
|
||||
modifiable and linear to the point you care about (writable_len).
|
||||
Returns true or false. */
|
||||
extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
|
||||
|
||||
static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
|
||||
{
|
||||
__be32 diff[] = { ~from, to };
|
||||
|
||||
*sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
|
||||
}
|
||||
|
||||
static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
|
||||
{
|
||||
nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
|
||||
}
|
||||
|
||||
extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
|
||||
__be32 from, __be32 to, int pseudohdr);
|
||||
|
||||
static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
|
||||
__be16 from, __be16 to, int pseudohdr)
|
||||
{
|
||||
nf_proto_csum_replace4(sum, skb, (__force __be32)from,
|
||||
(__force __be32)to, pseudohdr);
|
||||
}
|
||||
struct flowi;
|
||||
struct nf_queue_entry;
|
||||
|
||||
struct nf_afinfo {
|
||||
unsigned short family;
|
||||
__sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
|
||||
unsigned int dataoff, u_int8_t protocol);
|
||||
int (*route)(struct dst_entry **dst, struct flowi *fl);
|
||||
void (*saveroute)(const struct sk_buff *skb,
|
||||
struct nf_info *info);
|
||||
struct nf_queue_entry *entry);
|
||||
int (*reroute)(struct sk_buff *skb,
|
||||
const struct nf_info *info);
|
||||
const struct nf_queue_entry *entry);
|
||||
int route_key_size;
|
||||
};
|
||||
|
||||
extern struct nf_afinfo *nf_afinfo[];
|
||||
static inline struct nf_afinfo *nf_get_afinfo(unsigned short family)
|
||||
extern const struct nf_afinfo *nf_afinfo[NPROTO];
|
||||
static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
|
||||
{
|
||||
return rcu_dereference(nf_afinfo[family]);
|
||||
}
|
||||
@@ -332,7 +242,7 @@ static inline __sum16
|
||||
nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
|
||||
u_int8_t protocol, unsigned short family)
|
||||
{
|
||||
struct nf_afinfo *afinfo;
|
||||
const struct nf_afinfo *afinfo;
|
||||
__sum16 csum = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
@@ -343,10 +253,8 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
|
||||
return csum;
|
||||
}
|
||||
|
||||
extern int nf_register_afinfo(struct nf_afinfo *afinfo);
|
||||
extern void nf_unregister_afinfo(struct nf_afinfo *afinfo);
|
||||
|
||||
#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
|
||||
extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
|
||||
extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
|
||||
|
||||
#include <net/flow.h>
|
||||
extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
|
||||
@@ -354,11 +262,16 @@ extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
|
||||
static inline void
|
||||
nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
|
||||
{
|
||||
#if defined(CONFIG_IP_NF_NAT_NEEDED) || defined(CONFIG_NF_NAT_NEEDED)
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
void (*decodefn)(struct sk_buff *, struct flowi *);
|
||||
|
||||
if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL)
|
||||
decodefn(skb, fl);
|
||||
if (family == AF_INET) {
|
||||
rcu_read_lock();
|
||||
decodefn = rcu_dereference(ip_nat_decode_session);
|
||||
if (decodefn)
|
||||
decodefn(skb, fl);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@ header-y += xt_DSCP.h
|
||||
header-y += xt_MARK.h
|
||||
header-y += xt_NFLOG.h
|
||||
header-y += xt_NFQUEUE.h
|
||||
header-y += xt_RATEEST.h
|
||||
header-y += xt_SECMARK.h
|
||||
header-y += xt_TCPMSS.h
|
||||
header-y += xt_comment.h
|
||||
@@ -20,14 +21,17 @@ header-y += xt_dccp.h
|
||||
header-y += xt_dscp.h
|
||||
header-y += xt_esp.h
|
||||
header-y += xt_hashlimit.h
|
||||
header-y += xt_iprange.h
|
||||
header-y += xt_helper.h
|
||||
header-y += xt_length.h
|
||||
header-y += xt_limit.h
|
||||
header-y += xt_mac.h
|
||||
header-y += xt_mark.h
|
||||
header-y += xt_multiport.h
|
||||
header-y += xt_owner.h
|
||||
header-y += xt_pkttype.h
|
||||
header-y += xt_policy.h
|
||||
header-y += xt_rateest.h
|
||||
header-y += xt_realm.h
|
||||
header-y += xt_sctp.h
|
||||
header-y += xt_state.h
|
||||
|
@@ -129,6 +129,14 @@ enum ip_conntrack_events
|
||||
/* Mark is set */
|
||||
IPCT_MARK_BIT = 12,
|
||||
IPCT_MARK = (1 << IPCT_MARK_BIT),
|
||||
|
||||
/* NAT sequence adjustment */
|
||||
IPCT_NATSEQADJ_BIT = 13,
|
||||
IPCT_NATSEQADJ = (1 << IPCT_NATSEQADJ_BIT),
|
||||
|
||||
/* Secmark is set */
|
||||
IPCT_SECMARK_BIT = 14,
|
||||
IPCT_SECMARK = (1 << IPCT_SECMARK_BIT),
|
||||
};
|
||||
|
||||
enum ip_conntrack_expect_events {
|
||||
|
@@ -31,7 +31,7 @@ struct nf_conn;
|
||||
|
||||
extern int get_h225_addr(struct nf_conn *ct, unsigned char *data,
|
||||
TransportAddress *taddr,
|
||||
union nf_conntrack_address *addr, __be16 *port);
|
||||
union nf_inet_addr *addr, __be16 *port);
|
||||
extern void nf_conntrack_h245_expect(struct nf_conn *new,
|
||||
struct nf_conntrack_expect *this);
|
||||
extern void nf_conntrack_q931_expect(struct nf_conn *new,
|
||||
@@ -39,12 +39,12 @@ extern void nf_conntrack_q931_expect(struct nf_conn *new,
|
||||
extern int (*set_h245_addr_hook) (struct sk_buff *skb,
|
||||
unsigned char **data, int dataoff,
|
||||
H245_TransportAddress *taddr,
|
||||
union nf_conntrack_address *addr,
|
||||
union nf_inet_addr *addr,
|
||||
__be16 port);
|
||||
extern int (*set_h225_addr_hook) (struct sk_buff *skb,
|
||||
unsigned char **data, int dataoff,
|
||||
TransportAddress *taddr,
|
||||
union nf_conntrack_address *addr,
|
||||
union nf_inet_addr *addr,
|
||||
__be16 port);
|
||||
extern int (*set_sig_addr_hook) (struct sk_buff *skb,
|
||||
struct nf_conn *ct,
|
||||
|
@@ -21,7 +21,6 @@ struct ip_ct_sctp
|
||||
enum sctp_conntrack state;
|
||||
|
||||
__be32 vtag[IP_CT_DIR_MAX];
|
||||
u_int32_t ttag[IP_CT_DIR_MAX];
|
||||
};
|
||||
|
||||
#endif /* _NF_CONNTRACK_SCTP_H */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user