Merge tag 'v3.4-rc3' into staging/for_v3.5
* tag 'v3.4-rc3': (3755 commits) Linux 3.4-rc3 x86-32: fix up strncpy_from_user() sign error ARM: 7386/1: jump_label: fixup for rename to static_key ARM: 7384/1: ThumbEE: Disable userspace TEEHBR access for !CONFIG_ARM_THUMBEE ARM: 7382/1: mm: truncate memory banks to fit in 4GB space for classic MMU ARM: 7359/2: smp_twd: Only wait for reprogramming on active cpus PCI: Fix regression in pci_restore_state(), v3 SCSI: Fix error handling when no ULD is attached ARM: OMAP: clock: cleanup CPUfreq leftovers, fix build errors ARM: dts: remove blank interrupt-parent properties ARM: EXYNOS: Fix Kconfig dependencies for device tree enabled machine files do not export kernel's NULL #define to userspace ARM: EXYNOS: Remove broken config values for touchscren for NURI board ARM: EXYNOS: set fix xusbxti clock for NURI and Universal210 boards ARM: EXYNOS: fix regulator name for NURI board ARM: SAMSUNG: make SAMSUNG_PM_DEBUG select DEBUG_LL cpufreq: OMAP: fix build errors: depends on ARCH_OMAP2PLUS sparc64: Eliminate obsolete __handle_softirq() function sparc64: Fix bootup crash on sun4v. ARM: msm: Fix section mismatches in proc_comm.c ...
This commit is contained in:
commit
d5aeee8cb2
5693 changed files with 147299 additions and 73259 deletions
|
|
@ -3,6 +3,7 @@ header-y += can/
|
|||
header-y += caif/
|
||||
header-y += dvb/
|
||||
header-y += hdlc/
|
||||
header-y += hsi/
|
||||
header-y += isdn/
|
||||
header-y += mmc/
|
||||
header-y += nfsd/
|
||||
|
|
@ -120,7 +121,6 @@ header-y += errno.h
|
|||
header-y += errqueue.h
|
||||
header-y += ethtool.h
|
||||
header-y += eventpoll.h
|
||||
header-y += ext2_fs.h
|
||||
header-y += fadvise.h
|
||||
header-y += falloc.h
|
||||
header-y += fanotify.h
|
||||
|
|
@ -357,6 +357,7 @@ header-y += suspend_ioctls.h
|
|||
header-y += swab.h
|
||||
header-y += synclink.h
|
||||
header-y += sysctl.h
|
||||
header-y += sysinfo.h
|
||||
header-y += taskstats.h
|
||||
header-y += tcp.h
|
||||
header-y += telephony.h
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ extern int ec_write(u8 addr, u8 val);
|
|||
extern int ec_transaction(u8 command,
|
||||
const u8 *wdata, unsigned wdata_len,
|
||||
u8 *rdata, unsigned rdata_len);
|
||||
extern acpi_handle ec_get_handle(void);
|
||||
|
||||
#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
|
||||
|
||||
|
|
@ -371,4 +372,14 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
|
|||
|
||||
#endif /* !CONFIG_ACPI */
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
|
||||
u32 pm1a_ctrl, u32 pm1b_ctrl));
|
||||
|
||||
acpi_status acpi_os_prepare_sleep(u8 sleep_state,
|
||||
u32 pm1a_control, u32 pm1b_control);
|
||||
#else
|
||||
#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif /*_LINUX_ACPI_H*/
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
typedef unsigned long aio_context_t;
|
||||
typedef __kernel_ulong_t aio_context_t;
|
||||
|
||||
enum {
|
||||
IOCB_CMD_PREAD = 0,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ struct amba_device {
|
|||
struct device dev;
|
||||
struct resource res;
|
||||
struct clk *pclk;
|
||||
struct regulator *vcore;
|
||||
u64 dma_mask;
|
||||
unsigned int periphid;
|
||||
unsigned int irq[AMBA_NR_IRQS];
|
||||
|
|
@ -60,6 +59,9 @@ extern struct bus_type amba_bustype;
|
|||
|
||||
int amba_driver_register(struct amba_driver *);
|
||||
void amba_driver_unregister(struct amba_driver *);
|
||||
struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
|
||||
void amba_device_put(struct amba_device *);
|
||||
int amba_device_add(struct amba_device *, struct resource *);
|
||||
int amba_device_register(struct amba_device *, struct resource *);
|
||||
void amba_device_unregister(struct amba_device *);
|
||||
struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
|
||||
|
|
@ -72,12 +74,6 @@ void amba_release_regions(struct amba_device *);
|
|||
#define amba_pclk_disable(d) \
|
||||
do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)
|
||||
|
||||
#define amba_vcore_enable(d) \
|
||||
(IS_ERR((d)->vcore) ? 0 : regulator_enable((d)->vcore))
|
||||
|
||||
#define amba_vcore_disable(d) \
|
||||
do { if (!IS_ERR((d)->vcore)) regulator_disable((d)->vcore); } while (0)
|
||||
|
||||
/* Some drivers don't use the struct amba_device */
|
||||
#define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff)
|
||||
#define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f)
|
||||
|
|
@ -89,4 +85,46 @@ void amba_release_regions(struct amba_device *);
|
|||
#define amba_manf(d) AMBA_MANF_BITS((d)->periphid)
|
||||
#define amba_part(d) AMBA_PART_BITS((d)->periphid)
|
||||
|
||||
#define __AMBA_DEV(busid, data, mask) \
|
||||
{ \
|
||||
.coherent_dma_mask = mask, \
|
||||
.init_name = busid, \
|
||||
.platform_data = data, \
|
||||
}
|
||||
|
||||
/*
|
||||
* APB devices do not themselves have the ability to address memory,
|
||||
* so DMA masks should be zero (much like USB peripheral devices.)
|
||||
* The DMA controller DMA masks should be used instead (much like
|
||||
* USB host controllers in conventional PCs.)
|
||||
*/
|
||||
#define AMBA_APB_DEVICE(name, busid, id, base, irqs, data) \
|
||||
struct amba_device name##_device = { \
|
||||
.dev = __AMBA_DEV(busid, data, 0), \
|
||||
.res = DEFINE_RES_MEM(base, SZ_4K), \
|
||||
.irq = irqs, \
|
||||
.periphid = id, \
|
||||
}
|
||||
|
||||
/*
|
||||
* AHB devices are DMA capable, so set their DMA masks
|
||||
*/
|
||||
#define AMBA_AHB_DEVICE(name, busid, id, base, irqs, data) \
|
||||
struct amba_device name##_device = { \
|
||||
.dev = __AMBA_DEV(busid, data, ~0ULL), \
|
||||
.res = DEFINE_RES_MEM(base, SZ_4K), \
|
||||
.dma_mask = ~0ULL, \
|
||||
.irq = irqs, \
|
||||
.periphid = id, \
|
||||
}
|
||||
|
||||
/*
|
||||
* module_amba_driver() - Helper macro for drivers that don't do anything
|
||||
* special in module init/exit. This eliminates a lot of boilerplate. Each
|
||||
* module may only use this macro once, and calling it replaces module_init()
|
||||
* and module_exit()
|
||||
*/
|
||||
#define module_amba_driver(__amba_drv) \
|
||||
module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,6 +6,19 @@
|
|||
|
||||
#include <linux/mmc/host.h>
|
||||
|
||||
|
||||
/*
|
||||
* These defines is places here due to access is needed from machine
|
||||
* configuration files. The ST Micro version does not have ROD and
|
||||
* reuse the voltage registers for direction settings.
|
||||
*/
|
||||
#define MCI_ST_DATA2DIREN (1 << 2)
|
||||
#define MCI_ST_CMDDIREN (1 << 3)
|
||||
#define MCI_ST_DATA0DIREN (1 << 4)
|
||||
#define MCI_ST_DATA31DIREN (1 << 5)
|
||||
#define MCI_ST_FBCLKEN (1 << 7)
|
||||
#define MCI_ST_DATA74DIREN (1 << 8)
|
||||
|
||||
/* Just some dummy forwarding */
|
||||
struct dma_chan;
|
||||
|
||||
|
|
@ -18,7 +31,8 @@ struct dma_chan;
|
|||
* @ocr_mask: available voltages on the 4 pins from the block, this
|
||||
* is ignored if a regulator is used, see the MMC_VDD_* masks in
|
||||
* mmc/host.h
|
||||
* @vdd_handler: a callback function to translate a MMC_VDD_*
|
||||
* @ios_handler: a callback function to act on specfic ios changes,
|
||||
* used for example to control a levelshifter
|
||||
* mask into a value to be binary (or set some other custom bits
|
||||
* in MMCIPWR) or:ed and written into the MMCIPWR register of the
|
||||
* block. May also control external power based on the power_mode.
|
||||
|
|
@ -31,6 +45,8 @@ struct dma_chan;
|
|||
* @capabilities: the capabilities of the block as implemented in
|
||||
* this platform, signify anything MMC_CAP_* from mmc/host.h
|
||||
* @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
|
||||
* @sigdir: a bit field indicating for what bits in the MMC bus the host
|
||||
* should enable signal direction indication.
|
||||
* @dma_filter: function used to select an appropriate RX and TX
|
||||
* DMA channel to be used for DMA, if and only if you're deploying the
|
||||
* generic DMA engine
|
||||
|
|
@ -46,14 +62,14 @@ struct dma_chan;
|
|||
struct mmci_platform_data {
|
||||
unsigned int f_max;
|
||||
unsigned int ocr_mask;
|
||||
u32 (*vdd_handler)(struct device *, unsigned int vdd,
|
||||
unsigned char power_mode);
|
||||
int (*ios_handler)(struct device *, struct mmc_ios *);
|
||||
unsigned int (*status)(struct device *);
|
||||
int gpio_wp;
|
||||
int gpio_cd;
|
||||
bool cd_invert;
|
||||
unsigned long capabilities;
|
||||
unsigned long capabilities2;
|
||||
u32 sigdir;
|
||||
bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
|
||||
void *dma_rx_param;
|
||||
void *dma_tx_param;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef _SSP_PL022_H
|
||||
#define _SSP_PL022_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/**
|
||||
* whether SSP is in loopback mode or not
|
||||
|
|
|
|||
|
|
@ -47,9 +47,6 @@ enum {
|
|||
* @muxval: a number usually used to poke into some mux regiser to
|
||||
* mux in the signal to this channel
|
||||
* @cctl_opt: default options for the channel control register
|
||||
* @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
|
||||
* channels. Fill with 'true' if peripheral should be flow controller. Direction
|
||||
* will be selected at Runtime.
|
||||
* @addr: source/target address in physical memory for this DMA channel,
|
||||
* can be the address of a FIFO register for burst requests for example.
|
||||
* This can be left undefined if the PrimeCell API is used for configuring
|
||||
|
|
@ -68,7 +65,6 @@ struct pl08x_channel_data {
|
|||
int max_signal;
|
||||
u32 muxval;
|
||||
u32 cctl;
|
||||
bool device_fc;
|
||||
dma_addr_t addr;
|
||||
bool circular_buffer;
|
||||
bool single;
|
||||
|
|
@ -176,13 +172,15 @@ enum pl08x_dma_chan_state {
|
|||
* @runtime_addr: address for RX/TX according to the runtime config
|
||||
* @runtime_direction: current direction of this channel according to
|
||||
* runtime config
|
||||
* @lc: last completed transaction on this channel
|
||||
* @pend_list: queued transactions pending on this channel
|
||||
* @at: active transaction on this channel
|
||||
* @lock: a lock for this channel data
|
||||
* @host: a pointer to the host (internal use)
|
||||
* @state: whether the channel is idle, paused, running etc
|
||||
* @slave: whether this channel is a device (slave) or for memcpy
|
||||
* @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
|
||||
* channels. Fill with 'true' if peripheral should be flow controller. Direction
|
||||
* will be selected at Runtime.
|
||||
* @waiting: a TX descriptor on this channel which is waiting for a physical
|
||||
* channel to become available
|
||||
*/
|
||||
|
|
@ -198,13 +196,13 @@ struct pl08x_dma_chan {
|
|||
u32 src_cctl;
|
||||
u32 dst_cctl;
|
||||
enum dma_transfer_direction runtime_direction;
|
||||
dma_cookie_t lc;
|
||||
struct list_head pend_list;
|
||||
struct pl08x_txd *at;
|
||||
spinlock_t lock;
|
||||
struct pl08x_driver_data *host;
|
||||
enum pl08x_dma_chan_state state;
|
||||
bool slave;
|
||||
bool device_fc;
|
||||
struct pl08x_txd *waiting;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#define __AMBA_PL330_H_
|
||||
|
||||
#include <linux/dmaengine.h>
|
||||
#include <asm/hardware/pl330.h>
|
||||
|
||||
struct dma_pl330_platdata {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ struct task_struct;
|
|||
struct pci_dev;
|
||||
|
||||
extern int amd_iommu_detect(void);
|
||||
|
||||
extern int amd_iommu_init_hardware(void);
|
||||
|
||||
/**
|
||||
* amd_iommu_enable_device_erratum() - Enable erratum workaround for device
|
||||
|
|
|
|||
26
include/linux/apple_bl.h
Normal file
26
include/linux/apple_bl.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* apple_bl exported symbols
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_APPLE_BL_H
|
||||
#define _LINUX_APPLE_BL_H
|
||||
|
||||
#ifdef CONFIG_BACKLIGHT_APPLE
|
||||
|
||||
extern int apple_bl_register(void);
|
||||
extern void apple_bl_unregister(void);
|
||||
|
||||
#else /* !CONFIG_BACKLIGHT_APPLE */
|
||||
|
||||
static inline int apple_bl_register(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void apple_bl_unregister(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_BACKLIGHT_APPLE */
|
||||
|
||||
#endif /* _LINUX_APPLE_BL_H */
|
||||
|
|
@ -213,10 +213,10 @@ struct atm_cirange {
|
|||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/wait.h> /* wait_queue_head_t */
|
||||
#include <linux/time.h> /* struct timeval */
|
||||
#include <linux/net.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/skbuff.h> /* struct sk_buff */
|
||||
#include <linux/uio.h>
|
||||
#include <net/sock.h>
|
||||
|
|
@ -249,6 +249,7 @@ struct k_atm_dev_stats {
|
|||
struct k_atm_aal_stats aal5;
|
||||
};
|
||||
|
||||
struct device;
|
||||
|
||||
enum {
|
||||
ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared
|
||||
|
|
|
|||
|
|
@ -33,11 +33,20 @@
|
|||
|
||||
struct clk;
|
||||
|
||||
/**
|
||||
* struct atmel_tcb_config - SoC data for a Timer/Counter Block
|
||||
* @counter_width: size in bits of a timer counter register
|
||||
*/
|
||||
struct atmel_tcb_config {
|
||||
size_t counter_width;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct atmel_tc - information about a Timer/Counter Block
|
||||
* @pdev: physical device
|
||||
* @iomem: resource associated with the I/O register
|
||||
* @regs: mapping through which the I/O registers can be accessed
|
||||
* @tcb_config: configuration data from SoC
|
||||
* @irq: irq for each of the three channels
|
||||
* @clk: internal clock source for each of the three channels
|
||||
* @node: list node, for tclib internal use
|
||||
|
|
@ -54,6 +63,7 @@ struct atmel_tc {
|
|||
struct platform_device *pdev;
|
||||
struct resource *iomem;
|
||||
void __iomem *regs;
|
||||
struct atmel_tcb_config *tcb_config;
|
||||
int irq[3];
|
||||
struct clk *clk[3];
|
||||
struct list_head node;
|
||||
|
|
|
|||
|
|
@ -9,10 +9,11 @@
|
|||
#ifndef _ATTRIBUTE_CONTAINER_H_
|
||||
#define _ATTRIBUTE_CONTAINER_H_
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/klist.h>
|
||||
|
||||
struct device;
|
||||
|
||||
struct attribute_container {
|
||||
struct list_head node;
|
||||
struct klist containers;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/highmem.h>
|
||||
#include <linux/mempool.h>
|
||||
#include <linux/ioprio.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
#ifdef CONFIG_BLOCK
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/preempt.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
/*
|
||||
* bit-based spin_lock()
|
||||
|
|
|
|||
|
|
@ -426,14 +426,10 @@ struct request_queue {
|
|||
(1 << QUEUE_FLAG_SAME_COMP) | \
|
||||
(1 << QUEUE_FLAG_ADD_RANDOM))
|
||||
|
||||
static inline int queue_is_locked(struct request_queue *q)
|
||||
static inline void queue_lockdep_assert_held(struct request_queue *q)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
spinlock_t *lock = q->queue_lock;
|
||||
return lock && spin_is_locked(lock);
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
if (q->queue_lock)
|
||||
lockdep_assert_held(q->queue_lock);
|
||||
}
|
||||
|
||||
static inline void queue_flag_set_unlocked(unsigned int flag,
|
||||
|
|
@ -445,7 +441,7 @@ static inline void queue_flag_set_unlocked(unsigned int flag,
|
|||
static inline int queue_flag_test_and_clear(unsigned int flag,
|
||||
struct request_queue *q)
|
||||
{
|
||||
WARN_ON_ONCE(!queue_is_locked(q));
|
||||
queue_lockdep_assert_held(q);
|
||||
|
||||
if (test_bit(flag, &q->queue_flags)) {
|
||||
__clear_bit(flag, &q->queue_flags);
|
||||
|
|
@ -458,7 +454,7 @@ static inline int queue_flag_test_and_clear(unsigned int flag,
|
|||
static inline int queue_flag_test_and_set(unsigned int flag,
|
||||
struct request_queue *q)
|
||||
{
|
||||
WARN_ON_ONCE(!queue_is_locked(q));
|
||||
queue_lockdep_assert_held(q);
|
||||
|
||||
if (!test_bit(flag, &q->queue_flags)) {
|
||||
__set_bit(flag, &q->queue_flags);
|
||||
|
|
@ -470,7 +466,7 @@ static inline int queue_flag_test_and_set(unsigned int flag,
|
|||
|
||||
static inline void queue_flag_set(unsigned int flag, struct request_queue *q)
|
||||
{
|
||||
WARN_ON_ONCE(!queue_is_locked(q));
|
||||
queue_lockdep_assert_held(q);
|
||||
__set_bit(flag, &q->queue_flags);
|
||||
}
|
||||
|
||||
|
|
@ -487,7 +483,7 @@ static inline int queue_in_flight(struct request_queue *q)
|
|||
|
||||
static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
|
||||
{
|
||||
WARN_ON_ONCE(!queue_is_locked(q));
|
||||
queue_lockdep_assert_held(q);
|
||||
__clear_bit(flag, &q->queue_flags);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,67 @@ enum bug_trap_type {
|
|||
|
||||
struct pt_regs;
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
|
||||
#define BUILD_BUG_ON_ZERO(e) (0)
|
||||
#define BUILD_BUG_ON_NULL(e) ((void*)0)
|
||||
#define BUILD_BUG_ON(condition)
|
||||
#define BUILD_BUG() (0)
|
||||
#else /* __CHECKER__ */
|
||||
|
||||
/* Force a compilation error if a constant expression is not a power of 2 */
|
||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
|
||||
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
|
||||
|
||||
/* Force a compilation error if condition is true, but also produce a
|
||||
result (of value 0 and type size_t), so the expression can be used
|
||||
e.g. in a structure initializer (or where-ever else comma expressions
|
||||
aren't permitted). */
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
|
||||
|
||||
/**
|
||||
* BUILD_BUG_ON - break compile if a condition is true.
|
||||
* @condition: the condition which the compiler should know is false.
|
||||
*
|
||||
* If you have some code which relies on certain constants being equal, or
|
||||
* other compile-time-evaluated condition, you should use BUILD_BUG_ON to
|
||||
* detect if someone changes it.
|
||||
*
|
||||
* The implementation uses gcc's reluctance to create a negative array, but
|
||||
* gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
|
||||
* to inline functions). So as a fallback we use the optimizer; if it can't
|
||||
* prove the condition is false, it will cause a link error on the undefined
|
||||
* "__build_bug_on_failed". This error message can be harder to track down
|
||||
* though, hence the two different methods.
|
||||
*/
|
||||
#ifndef __OPTIMIZE__
|
||||
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
||||
#else
|
||||
extern int __build_bug_on_failed;
|
||||
#define BUILD_BUG_ON(condition) \
|
||||
do { \
|
||||
((void)sizeof(char[1 - 2*!!(condition)])); \
|
||||
if (condition) __build_bug_on_failed = 1; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* BUILD_BUG - break compile if used.
|
||||
*
|
||||
* If you have some code that you expect the compiler to eliminate at
|
||||
* build time, you should use BUILD_BUG to detect if it is
|
||||
* unexpectedly used.
|
||||
*/
|
||||
#define BUILD_BUG() \
|
||||
do { \
|
||||
extern void __build_bug_failed(void) \
|
||||
__linktime_error("BUILD_BUG failed"); \
|
||||
__build_bug_failed(); \
|
||||
} while (0)
|
||||
|
||||
#endif /* __CHECKER__ */
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
#include <asm-generic/bug.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@
|
|||
* the Free Software Foundation
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/kmemcheck.h>
|
||||
|
||||
#define C2PORT_NAME_LEN 32
|
||||
|
||||
struct device;
|
||||
|
||||
/*
|
||||
* C2 port basic structs
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -910,7 +910,6 @@ struct mode_page_header {
|
|||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/fs.h> /* not really needed, later.. */
|
||||
#include <linux/device.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
struct packet_command
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#ifndef __CEPH_DECODE_H
|
||||
#define __CEPH_DECODE_H
|
||||
|
||||
#include <asm/unaligned.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/time.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <linux/backing-dev.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/exportfs.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mempool.h>
|
||||
#include <linux/pagemap.h>
|
||||
|
|
@ -207,7 +208,7 @@ extern struct kmem_cache *ceph_cap_cachep;
|
|||
extern struct kmem_cache *ceph_dentry_cachep;
|
||||
extern struct kmem_cache *ceph_file_cachep;
|
||||
|
||||
extern int ceph_parse_options(struct ceph_options **popt, char *options,
|
||||
extern struct ceph_options *ceph_parse_options(char *options,
|
||||
const char *dev_name, const char *dev_name_end,
|
||||
int (*parse_extra_token)(char *c, void *private),
|
||||
void *private);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef _FS_CEPH_MDSMAP_H
|
||||
#define _FS_CEPH_MDSMAP_H
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include "types.h"
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
struct ceph_msg;
|
||||
struct ceph_connection;
|
||||
|
||||
extern struct workqueue_struct *ceph_msgr_wq; /* receive work queue */
|
||||
|
||||
/*
|
||||
* Ceph defines these callbacks for handling connection events.
|
||||
*/
|
||||
|
|
@ -54,7 +52,6 @@ struct ceph_connection_operations {
|
|||
struct ceph_messenger {
|
||||
struct ceph_entity_inst inst; /* my name+address */
|
||||
struct ceph_entity_addr my_enc_addr;
|
||||
struct page *zero_page; /* used in certain error cases */
|
||||
|
||||
bool nocrc;
|
||||
|
||||
|
|
@ -101,7 +98,7 @@ struct ceph_msg {
|
|||
struct ceph_msg_pos {
|
||||
int page, page_pos; /* which page; offset in page */
|
||||
int data_pos; /* offset in data payload */
|
||||
int did_page_crc; /* true if we've calculated crc for current page */
|
||||
bool did_page_crc; /* true if we've calculated crc for current page */
|
||||
};
|
||||
|
||||
/* ceph connection fault delay defaults, for exponential backoff */
|
||||
|
|
|
|||
196
include/linux/clk-private.h
Normal file
196
include/linux/clk-private.h
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* linux/include/linux/clk-private.h
|
||||
*
|
||||
* Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
|
||||
* Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __LINUX_CLK_PRIVATE_H
|
||||
#define __LINUX_CLK_PRIVATE_H
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
/*
|
||||
* WARNING: Do not include clk-private.h from any file that implements struct
|
||||
* clk_ops. Doing so is a layering violation!
|
||||
*
|
||||
* This header exists only to allow for statically initialized clock data. Any
|
||||
* static clock data must be defined in a separate file from the logic that
|
||||
* implements the clock operations for that same data.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_COMMON_CLK
|
||||
|
||||
struct clk {
|
||||
const char *name;
|
||||
const struct clk_ops *ops;
|
||||
struct clk_hw *hw;
|
||||
struct clk *parent;
|
||||
char **parent_names;
|
||||
struct clk **parents;
|
||||
u8 num_parents;
|
||||
unsigned long rate;
|
||||
unsigned long new_rate;
|
||||
unsigned long flags;
|
||||
unsigned int enable_count;
|
||||
unsigned int prepare_count;
|
||||
struct hlist_head children;
|
||||
struct hlist_node child_node;
|
||||
unsigned int notifier_count;
|
||||
#ifdef CONFIG_COMMON_CLK_DEBUG
|
||||
struct dentry *dentry;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* DOC: Basic clock implementations common to many platforms
|
||||
*
|
||||
* Each basic clock hardware type is comprised of a structure describing the
|
||||
* clock hardware, implementations of the relevant callbacks in struct clk_ops,
|
||||
* unique flags for that hardware type, a registration function and an
|
||||
* alternative macro for static initialization
|
||||
*/
|
||||
|
||||
extern struct clk_ops clk_fixed_rate_ops;
|
||||
|
||||
#define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \
|
||||
_fixed_rate_flags) \
|
||||
static struct clk _name; \
|
||||
static char *_name##_parent_names[] = {}; \
|
||||
static struct clk_fixed_rate _name##_hw = { \
|
||||
.hw = { \
|
||||
.clk = &_name, \
|
||||
}, \
|
||||
.fixed_rate = _rate, \
|
||||
.flags = _fixed_rate_flags, \
|
||||
}; \
|
||||
static struct clk _name = { \
|
||||
.name = #_name, \
|
||||
.ops = &clk_fixed_rate_ops, \
|
||||
.hw = &_name##_hw.hw, \
|
||||
.parent_names = _name##_parent_names, \
|
||||
.num_parents = \
|
||||
ARRAY_SIZE(_name##_parent_names), \
|
||||
.flags = _flags, \
|
||||
};
|
||||
|
||||
extern struct clk_ops clk_gate_ops;
|
||||
|
||||
#define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \
|
||||
_flags, _reg, _bit_idx, \
|
||||
_gate_flags, _lock) \
|
||||
static struct clk _name; \
|
||||
static char *_name##_parent_names[] = { \
|
||||
_parent_name, \
|
||||
}; \
|
||||
static struct clk *_name##_parents[] = { \
|
||||
_parent_ptr, \
|
||||
}; \
|
||||
static struct clk_gate _name##_hw = { \
|
||||
.hw = { \
|
||||
.clk = &_name, \
|
||||
}, \
|
||||
.reg = _reg, \
|
||||
.bit_idx = _bit_idx, \
|
||||
.flags = _gate_flags, \
|
||||
.lock = _lock, \
|
||||
}; \
|
||||
static struct clk _name = { \
|
||||
.name = #_name, \
|
||||
.ops = &clk_gate_ops, \
|
||||
.hw = &_name##_hw.hw, \
|
||||
.parent_names = _name##_parent_names, \
|
||||
.num_parents = \
|
||||
ARRAY_SIZE(_name##_parent_names), \
|
||||
.parents = _name##_parents, \
|
||||
.flags = _flags, \
|
||||
};
|
||||
|
||||
extern struct clk_ops clk_divider_ops;
|
||||
|
||||
#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
|
||||
_flags, _reg, _shift, _width, \
|
||||
_divider_flags, _lock) \
|
||||
static struct clk _name; \
|
||||
static char *_name##_parent_names[] = { \
|
||||
_parent_name, \
|
||||
}; \
|
||||
static struct clk *_name##_parents[] = { \
|
||||
_parent_ptr, \
|
||||
}; \
|
||||
static struct clk_divider _name##_hw = { \
|
||||
.hw = { \
|
||||
.clk = &_name, \
|
||||
}, \
|
||||
.reg = _reg, \
|
||||
.shift = _shift, \
|
||||
.width = _width, \
|
||||
.flags = _divider_flags, \
|
||||
.lock = _lock, \
|
||||
}; \
|
||||
static struct clk _name = { \
|
||||
.name = #_name, \
|
||||
.ops = &clk_divider_ops, \
|
||||
.hw = &_name##_hw.hw, \
|
||||
.parent_names = _name##_parent_names, \
|
||||
.num_parents = \
|
||||
ARRAY_SIZE(_name##_parent_names), \
|
||||
.parents = _name##_parents, \
|
||||
.flags = _flags, \
|
||||
};
|
||||
|
||||
extern struct clk_ops clk_mux_ops;
|
||||
|
||||
#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \
|
||||
_reg, _shift, _width, \
|
||||
_mux_flags, _lock) \
|
||||
static struct clk _name; \
|
||||
static struct clk_mux _name##_hw = { \
|
||||
.hw = { \
|
||||
.clk = &_name, \
|
||||
}, \
|
||||
.reg = _reg, \
|
||||
.shift = _shift, \
|
||||
.width = _width, \
|
||||
.flags = _mux_flags, \
|
||||
.lock = _lock, \
|
||||
}; \
|
||||
static struct clk _name = { \
|
||||
.name = #_name, \
|
||||
.ops = &clk_mux_ops, \
|
||||
.hw = &_name##_hw.hw, \
|
||||
.parent_names = _parent_names, \
|
||||
.num_parents = \
|
||||
ARRAY_SIZE(_parent_names), \
|
||||
.parents = _parents, \
|
||||
.flags = _flags, \
|
||||
};
|
||||
|
||||
/**
|
||||
* __clk_init - initialize the data structures in a struct clk
|
||||
* @dev: device initializing this clk, placeholder for now
|
||||
* @clk: clk being initialized
|
||||
*
|
||||
* Initializes the lists in struct clk, queries the hardware for the
|
||||
* parent and rate and sets them both.
|
||||
*
|
||||
* Any struct clk passed into __clk_init must have the following members
|
||||
* populated:
|
||||
* .name
|
||||
* .ops
|
||||
* .hw
|
||||
* .parent_names
|
||||
* .num_parents
|
||||
* .flags
|
||||
*
|
||||
* It is not necessary to call clk_register if __clk_init is used directly with
|
||||
* statically initialized clock data.
|
||||
*/
|
||||
void __clk_init(struct device *dev, struct clk *clk);
|
||||
|
||||
#endif /* CONFIG_COMMON_CLK */
|
||||
#endif /* CLK_PRIVATE_H */
|
||||
300
include/linux/clk-provider.h
Normal file
300
include/linux/clk-provider.h
Normal file
|
|
@ -0,0 +1,300 @@
|
|||
/*
|
||||
* linux/include/linux/clk-provider.h
|
||||
*
|
||||
* Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
|
||||
* Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __LINUX_CLK_PROVIDER_H
|
||||
#define __LINUX_CLK_PROVIDER_H
|
||||
|
||||
#include <linux/clk.h>
|
||||
|
||||
#ifdef CONFIG_COMMON_CLK
|
||||
|
||||
/**
|
||||
* struct clk_hw - handle for traversing from a struct clk to its corresponding
|
||||
* hardware-specific structure. struct clk_hw should be declared within struct
|
||||
* clk_foo and then referenced by the struct clk instance that uses struct
|
||||
* clk_foo's clk_ops
|
||||
*
|
||||
* clk: pointer to the struct clk instance that points back to this struct
|
||||
* clk_hw instance
|
||||
*/
|
||||
struct clk_hw {
|
||||
struct clk *clk;
|
||||
};
|
||||
|
||||
/*
|
||||
* flags used across common struct clk. these flags should only affect the
|
||||
* top-level framework. custom flags for dealing with hardware specifics
|
||||
* belong in struct clk_foo
|
||||
*/
|
||||
#define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */
|
||||
#define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */
|
||||
#define CLK_SET_RATE_PARENT BIT(2) /* propagate rate change up one level */
|
||||
#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */
|
||||
#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
|
||||
|
||||
/**
|
||||
* struct clk_ops - Callback operations for hardware clocks; these are to
|
||||
* be provided by the clock implementation, and will be called by drivers
|
||||
* through the clk_* api.
|
||||
*
|
||||
* @prepare: Prepare the clock for enabling. This must not return until
|
||||
* the clock is fully prepared, and it's safe to call clk_enable.
|
||||
* This callback is intended to allow clock implementations to
|
||||
* do any initialisation that may sleep. Called with
|
||||
* prepare_lock held.
|
||||
*
|
||||
* @unprepare: Release the clock from its prepared state. This will typically
|
||||
* undo any work done in the @prepare callback. Called with
|
||||
* prepare_lock held.
|
||||
*
|
||||
* @enable: Enable the clock atomically. This must not return until the
|
||||
* clock is generating a valid clock signal, usable by consumer
|
||||
* devices. Called with enable_lock held. This function must not
|
||||
* sleep.
|
||||
*
|
||||
* @disable: Disable the clock atomically. Called with enable_lock held.
|
||||
* This function must not sleep.
|
||||
*
|
||||
* @recalc_rate Recalculate the rate of this clock, by quering hardware. The
|
||||
* parent rate is an input parameter. It is up to the caller to
|
||||
* insure that the prepare_mutex is held across this call.
|
||||
* Returns the calculated rate. Optional, but recommended - if
|
||||
* this op is not set then clock rate will be initialized to 0.
|
||||
*
|
||||
* @round_rate: Given a target rate as input, returns the closest rate actually
|
||||
* supported by the clock.
|
||||
*
|
||||
* @get_parent: Queries the hardware to determine the parent of a clock. The
|
||||
* return value is a u8 which specifies the index corresponding to
|
||||
* the parent clock. This index can be applied to either the
|
||||
* .parent_names or .parents arrays. In short, this function
|
||||
* translates the parent value read from hardware into an array
|
||||
* index. Currently only called when the clock is initialized by
|
||||
* __clk_init. This callback is mandatory for clocks with
|
||||
* multiple parents. It is optional (and unnecessary) for clocks
|
||||
* with 0 or 1 parents.
|
||||
*
|
||||
* @set_parent: Change the input source of this clock; for clocks with multiple
|
||||
* possible parents specify a new parent by passing in the index
|
||||
* as a u8 corresponding to the parent in either the .parent_names
|
||||
* or .parents arrays. This function in affect translates an
|
||||
* array index into the value programmed into the hardware.
|
||||
* Returns 0 on success, -EERROR otherwise.
|
||||
*
|
||||
* @set_rate: Change the rate of this clock. If this callback returns
|
||||
* CLK_SET_RATE_PARENT, the rate change will be propagated to the
|
||||
* parent clock (which may propagate again if the parent clock
|
||||
* also sets this flag). The requested rate of the parent is
|
||||
* passed back from the callback in the second 'unsigned long *'
|
||||
* argument. Note that it is up to the hardware clock's set_rate
|
||||
* implementation to insure that clocks do not run out of spec
|
||||
* when propgating the call to set_rate up to the parent. One way
|
||||
* to do this is to gate the clock (via clk_disable and/or
|
||||
* clk_unprepare) before calling clk_set_rate, then ungating it
|
||||
* afterward. If your clock also has the CLK_GATE_SET_RATE flag
|
||||
* set then this will insure safety. Returns 0 on success,
|
||||
* -EERROR otherwise.
|
||||
*
|
||||
* The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
|
||||
* implementations to split any work between atomic (enable) and sleepable
|
||||
* (prepare) contexts. If enabling a clock requires code that might sleep,
|
||||
* this must be done in clk_prepare. Clock enable code that will never be
|
||||
* called in a sleepable context may be implement in clk_enable.
|
||||
*
|
||||
* Typically, drivers will call clk_prepare when a clock may be needed later
|
||||
* (eg. when a device is opened), and clk_enable when the clock is actually
|
||||
* required (eg. from an interrupt). Note that clk_prepare MUST have been
|
||||
* called before clk_enable.
|
||||
*/
|
||||
struct clk_ops {
|
||||
int (*prepare)(struct clk_hw *hw);
|
||||
void (*unprepare)(struct clk_hw *hw);
|
||||
int (*enable)(struct clk_hw *hw);
|
||||
void (*disable)(struct clk_hw *hw);
|
||||
int (*is_enabled)(struct clk_hw *hw);
|
||||
unsigned long (*recalc_rate)(struct clk_hw *hw,
|
||||
unsigned long parent_rate);
|
||||
long (*round_rate)(struct clk_hw *hw, unsigned long,
|
||||
unsigned long *);
|
||||
int (*set_parent)(struct clk_hw *hw, u8 index);
|
||||
u8 (*get_parent)(struct clk_hw *hw);
|
||||
int (*set_rate)(struct clk_hw *hw, unsigned long);
|
||||
void (*init)(struct clk_hw *hw);
|
||||
};
|
||||
|
||||
/*
|
||||
* DOC: Basic clock implementations common to many platforms
|
||||
*
|
||||
* Each basic clock hardware type is comprised of a structure describing the
|
||||
* clock hardware, implementations of the relevant callbacks in struct clk_ops,
|
||||
* unique flags for that hardware type, a registration function and an
|
||||
* alternative macro for static initialization
|
||||
*/
|
||||
|
||||
/**
|
||||
* struct clk_fixed_rate - fixed-rate clock
|
||||
* @hw: handle between common and hardware-specific interfaces
|
||||
* @fixed_rate: constant frequency of clock
|
||||
*/
|
||||
struct clk_fixed_rate {
|
||||
struct clk_hw hw;
|
||||
unsigned long fixed_rate;
|
||||
u8 flags;
|
||||
};
|
||||
|
||||
struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
|
||||
const char *parent_name, unsigned long flags,
|
||||
unsigned long fixed_rate);
|
||||
|
||||
/**
|
||||
* struct clk_gate - gating clock
|
||||
*
|
||||
* @hw: handle between common and hardware-specific interfaces
|
||||
* @reg: register controlling gate
|
||||
* @bit_idx: single bit controlling gate
|
||||
* @flags: hardware-specific flags
|
||||
* @lock: register lock
|
||||
*
|
||||
* Clock which can gate its output. Implements .enable & .disable
|
||||
*
|
||||
* Flags:
|
||||
* CLK_GATE_SET_DISABLE - by default this clock sets the bit at bit_idx to
|
||||
* enable the clock. Setting this flag does the opposite: setting the bit
|
||||
* disable the clock and clearing it enables the clock
|
||||
*/
|
||||
struct clk_gate {
|
||||
struct clk_hw hw;
|
||||
void __iomem *reg;
|
||||
u8 bit_idx;
|
||||
u8 flags;
|
||||
spinlock_t *lock;
|
||||
char *parent[1];
|
||||
};
|
||||
|
||||
#define CLK_GATE_SET_TO_DISABLE BIT(0)
|
||||
|
||||
struct clk *clk_register_gate(struct device *dev, const char *name,
|
||||
const char *parent_name, unsigned long flags,
|
||||
void __iomem *reg, u8 bit_idx,
|
||||
u8 clk_gate_flags, spinlock_t *lock);
|
||||
|
||||
/**
|
||||
* struct clk_divider - adjustable divider clock
|
||||
*
|
||||
* @hw: handle between common and hardware-specific interfaces
|
||||
* @reg: register containing the divider
|
||||
* @shift: shift to the divider bit field
|
||||
* @width: width of the divider bit field
|
||||
* @lock: register lock
|
||||
*
|
||||
* Clock with an adjustable divider affecting its output frequency. Implements
|
||||
* .recalc_rate, .set_rate and .round_rate
|
||||
*
|
||||
* Flags:
|
||||
* CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the
|
||||
* register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is
|
||||
* the raw value read from the register, with the value of zero considered
|
||||
* invalid
|
||||
* CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from
|
||||
* the hardware register
|
||||
*/
|
||||
struct clk_divider {
|
||||
struct clk_hw hw;
|
||||
void __iomem *reg;
|
||||
u8 shift;
|
||||
u8 width;
|
||||
u8 flags;
|
||||
spinlock_t *lock;
|
||||
char *parent[1];
|
||||
};
|
||||
|
||||
#define CLK_DIVIDER_ONE_BASED BIT(0)
|
||||
#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
|
||||
|
||||
struct clk *clk_register_divider(struct device *dev, const char *name,
|
||||
const char *parent_name, unsigned long flags,
|
||||
void __iomem *reg, u8 shift, u8 width,
|
||||
u8 clk_divider_flags, spinlock_t *lock);
|
||||
|
||||
/**
|
||||
* struct clk_mux - multiplexer clock
|
||||
*
|
||||
* @hw: handle between common and hardware-specific interfaces
|
||||
* @reg: register controlling multiplexer
|
||||
* @shift: shift to multiplexer bit field
|
||||
* @width: width of mutliplexer bit field
|
||||
* @num_clks: number of parent clocks
|
||||
* @lock: register lock
|
||||
*
|
||||
* Clock with multiple selectable parents. Implements .get_parent, .set_parent
|
||||
* and .recalc_rate
|
||||
*
|
||||
* Flags:
|
||||
* CLK_MUX_INDEX_ONE - register index starts at 1, not 0
|
||||
* CLK_MUX_INDEX_BITWISE - register index is a single bit (power of two)
|
||||
*/
|
||||
struct clk_mux {
|
||||
struct clk_hw hw;
|
||||
void __iomem *reg;
|
||||
u8 shift;
|
||||
u8 width;
|
||||
u8 flags;
|
||||
spinlock_t *lock;
|
||||
};
|
||||
|
||||
#define CLK_MUX_INDEX_ONE BIT(0)
|
||||
#define CLK_MUX_INDEX_BIT BIT(1)
|
||||
|
||||
struct clk *clk_register_mux(struct device *dev, const char *name,
|
||||
char **parent_names, u8 num_parents, unsigned long flags,
|
||||
void __iomem *reg, u8 shift, u8 width,
|
||||
u8 clk_mux_flags, spinlock_t *lock);
|
||||
|
||||
/**
|
||||
* clk_register - allocate a new clock, register it and return an opaque cookie
|
||||
* @dev: device that is registering this clock
|
||||
* @name: clock name
|
||||
* @ops: operations this clock supports
|
||||
* @hw: link to hardware-specific clock data
|
||||
* @parent_names: array of string names for all possible parents
|
||||
* @num_parents: number of possible parents
|
||||
* @flags: framework-level hints and quirks
|
||||
*
|
||||
* clk_register is the primary interface for populating the clock tree with new
|
||||
* clock nodes. It returns a pointer to the newly allocated struct clk which
|
||||
* cannot be dereferenced by driver code but may be used in conjuction with the
|
||||
* rest of the clock API.
|
||||
*/
|
||||
struct clk *clk_register(struct device *dev, const char *name,
|
||||
const struct clk_ops *ops, struct clk_hw *hw,
|
||||
char **parent_names, u8 num_parents, unsigned long flags);
|
||||
|
||||
/* helper functions */
|
||||
const char *__clk_get_name(struct clk *clk);
|
||||
struct clk_hw *__clk_get_hw(struct clk *clk);
|
||||
u8 __clk_get_num_parents(struct clk *clk);
|
||||
struct clk *__clk_get_parent(struct clk *clk);
|
||||
inline int __clk_get_enable_count(struct clk *clk);
|
||||
inline int __clk_get_prepare_count(struct clk *clk);
|
||||
unsigned long __clk_get_rate(struct clk *clk);
|
||||
unsigned long __clk_get_flags(struct clk *clk);
|
||||
int __clk_is_enabled(struct clk *clk);
|
||||
struct clk *__clk_lookup(const char *name);
|
||||
|
||||
/*
|
||||
* FIXME clock api without lock protection
|
||||
*/
|
||||
int __clk_prepare(struct clk *clk);
|
||||
void __clk_unprepare(struct clk *clk);
|
||||
void __clk_reparent(struct clk *clk, struct clk *new_parent);
|
||||
unsigned long __clk_round_rate(struct clk *clk, unsigned long rate);
|
||||
|
||||
#endif /* CONFIG_COMMON_CLK */
|
||||
#endif /* CLK_PROVIDER_H */
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004 ARM Limited.
|
||||
* Written by Deep Blue Solutions Limited.
|
||||
* Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
|
|
@ -12,19 +13,76 @@
|
|||
#define __LINUX_CLK_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
struct device;
|
||||
|
||||
/*
|
||||
* The base API.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* struct clk - an machine class defined object / cookie.
|
||||
*/
|
||||
struct clk;
|
||||
|
||||
#ifdef CONFIG_COMMON_CLK
|
||||
|
||||
/**
|
||||
* DOC: clk notifier callback types
|
||||
*
|
||||
* PRE_RATE_CHANGE - called immediately before the clk rate is changed,
|
||||
* to indicate that the rate change will proceed. Drivers must
|
||||
* immediately terminate any operations that will be affected by the
|
||||
* rate change. Callbacks may either return NOTIFY_DONE or
|
||||
* NOTIFY_STOP.
|
||||
*
|
||||
* ABORT_RATE_CHANGE: called if the rate change failed for some reason
|
||||
* after PRE_RATE_CHANGE. In this case, all registered notifiers on
|
||||
* the clk will be called with ABORT_RATE_CHANGE. Callbacks must
|
||||
* always return NOTIFY_DONE.
|
||||
*
|
||||
* POST_RATE_CHANGE - called after the clk rate change has successfully
|
||||
* completed. Callbacks must always return NOTIFY_DONE.
|
||||
*
|
||||
*/
|
||||
#define PRE_RATE_CHANGE BIT(0)
|
||||
#define POST_RATE_CHANGE BIT(1)
|
||||
#define ABORT_RATE_CHANGE BIT(2)
|
||||
|
||||
/**
|
||||
* struct clk_notifier - associate a clk with a notifier
|
||||
* @clk: struct clk * to associate the notifier with
|
||||
* @notifier_head: a blocking_notifier_head for this clk
|
||||
* @node: linked list pointers
|
||||
*
|
||||
* A list of struct clk_notifier is maintained by the notifier code.
|
||||
* An entry is created whenever code registers the first notifier on a
|
||||
* particular @clk. Future notifiers on that @clk are added to the
|
||||
* @notifier_head.
|
||||
*/
|
||||
struct clk_notifier {
|
||||
struct clk *clk;
|
||||
struct srcu_notifier_head notifier_head;
|
||||
struct list_head node;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct clk_notifier_data - rate data to pass to the notifier callback
|
||||
* @clk: struct clk * being changed
|
||||
* @old_rate: previous rate of this clk
|
||||
* @new_rate: new rate of this clk
|
||||
*
|
||||
* For a pre-notifier, old_rate is the clk's rate before this rate
|
||||
* change, and new_rate is what the rate will be in the future. For a
|
||||
* post-notifier, old_rate and new_rate are both set to the clk's
|
||||
* current rate (this was done to optimize the implementation).
|
||||
*/
|
||||
struct clk_notifier_data {
|
||||
struct clk *clk;
|
||||
unsigned long old_rate;
|
||||
unsigned long new_rate;
|
||||
};
|
||||
|
||||
int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
|
||||
|
||||
int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
|
||||
|
||||
#endif /* !CONFIG_COMMON_CLK */
|
||||
|
||||
/**
|
||||
* clk_get - lookup and obtain a reference to a clock producer.
|
||||
* @dev: device for clock "consumer"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
/* this is used only to give gcc a clue about good code generation */
|
||||
union cnt32_to_63 {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@
|
|||
#include <asm/siginfo.h>
|
||||
#include <asm/signal.h>
|
||||
|
||||
#ifndef COMPAT_USE_64BIT_TIME
|
||||
#define COMPAT_USE_64BIT_TIME 0
|
||||
#endif
|
||||
|
||||
#define compat_jiffies_to_clock_t(x) \
|
||||
(((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
|
||||
|
||||
|
|
@ -83,10 +87,26 @@ typedef struct {
|
|||
compat_sigset_word sig[_COMPAT_NSIG_WORDS];
|
||||
} compat_sigset_t;
|
||||
|
||||
/*
|
||||
* These functions operate strictly on struct compat_time*
|
||||
*/
|
||||
extern int get_compat_timespec(struct timespec *,
|
||||
const struct compat_timespec __user *);
|
||||
extern int put_compat_timespec(const struct timespec *,
|
||||
struct compat_timespec __user *);
|
||||
extern int get_compat_timeval(struct timeval *,
|
||||
const struct compat_timeval __user *);
|
||||
extern int put_compat_timeval(const struct timeval *,
|
||||
struct compat_timeval __user *);
|
||||
/*
|
||||
* These functions operate on 32- or 64-bit specs depending on
|
||||
* COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the
|
||||
* naming as compat_get/put_ rather than get/put_compat_.
|
||||
*/
|
||||
extern int compat_get_timespec(struct timespec *, const void __user *);
|
||||
extern int compat_put_timespec(const struct timespec *, void __user *);
|
||||
extern int compat_get_timeval(struct timeval *, const void __user *);
|
||||
extern int compat_put_timeval(const struct timeval *, void __user *);
|
||||
|
||||
struct compat_iovec {
|
||||
compat_uptr_t iov_base;
|
||||
|
|
@ -224,6 +244,7 @@ struct compat_sysinfo;
|
|||
struct compat_sysctl_args;
|
||||
struct compat_kexec_segment;
|
||||
struct compat_mq_attr;
|
||||
struct compat_msgbuf;
|
||||
|
||||
extern void compat_exit_robust_list(struct task_struct *curr);
|
||||
|
||||
|
|
@ -234,13 +255,22 @@ asmlinkage long
|
|||
compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
|
||||
compat_size_t __user *len_ptr);
|
||||
|
||||
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
|
||||
long compat_sys_semctl(int first, int second, int third, void __user *uptr);
|
||||
long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
|
||||
long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
|
||||
int version, void __user *uptr);
|
||||
long compat_sys_msgctl(int first, int second, void __user *uptr);
|
||||
long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
|
||||
void __user *uptr);
|
||||
#else
|
||||
long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
|
||||
long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
|
||||
size_t msgsz, int msgflg);
|
||||
long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp,
|
||||
size_t msgsz, long msgtyp, int msgflg);
|
||||
long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
|
||||
#endif
|
||||
long compat_sys_msgctl(int first, int second, void __user *uptr);
|
||||
long compat_sys_shmctl(int first, int second, void __user *uptr);
|
||||
long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
|
||||
unsigned nsems, const struct compat_timespec __user *timeout);
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@
|
|||
#ifndef _LINUX_CPU_H_
|
||||
#define _LINUX_CPU_H_
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/node.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
struct device;
|
||||
|
||||
struct cpu {
|
||||
int node_id; /* The node which contains the CPU */
|
||||
int hotpluggable; /* creates sysfs control file if hotpluggable */
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/threads.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/completion.h>
|
||||
|
|
@ -35,6 +34,7 @@
|
|||
#ifdef CONFIG_CPU_FREQ
|
||||
int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
|
||||
int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
|
||||
extern void disable_cpufreq(void);
|
||||
#else /* CONFIG_CPU_FREQ */
|
||||
static inline int cpufreq_register_notifier(struct notifier_block *nb,
|
||||
unsigned int list)
|
||||
|
|
@ -46,6 +46,7 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void disable_cpufreq(void) { }
|
||||
#endif /* CONFIG_CPU_FREQ */
|
||||
|
||||
/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/hrtimer.h>
|
||||
|
||||
#define CPUIDLE_STATE_MAX 8
|
||||
#define CPUIDLE_NAME_LEN 16
|
||||
|
|
@ -43,12 +44,15 @@ struct cpuidle_state {
|
|||
|
||||
unsigned int flags;
|
||||
unsigned int exit_latency; /* in US */
|
||||
unsigned int power_usage; /* in mW */
|
||||
int power_usage; /* in mW */
|
||||
unsigned int target_residency; /* in US */
|
||||
unsigned int disable;
|
||||
|
||||
int (*enter) (struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index);
|
||||
|
||||
int (*enter_dead) (struct cpuidle_device *dev, int index);
|
||||
};
|
||||
|
||||
/* Idle State Flags */
|
||||
|
|
@ -96,7 +100,6 @@ struct cpuidle_device {
|
|||
struct list_head device_list;
|
||||
struct kobject kobj;
|
||||
struct completion kobj_unregister;
|
||||
void *governor_data;
|
||||
};
|
||||
|
||||
DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
|
||||
|
|
@ -118,10 +121,12 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
|
|||
****************************/
|
||||
|
||||
struct cpuidle_driver {
|
||||
char name[CPUIDLE_NAME_LEN];
|
||||
const char *name;
|
||||
struct module *owner;
|
||||
|
||||
unsigned int power_specified:1;
|
||||
/* set to 1 to use the core cpuidle time keeping (for all states). */
|
||||
unsigned int en_core_tk_irqen:1;
|
||||
struct cpuidle_state states[CPUIDLE_STATE_MAX];
|
||||
int state_count;
|
||||
int safe_state_index;
|
||||
|
|
@ -140,6 +145,11 @@ extern void cpuidle_pause_and_lock(void);
|
|||
extern void cpuidle_resume_and_unlock(void);
|
||||
extern int cpuidle_enable_device(struct cpuidle_device *dev);
|
||||
extern void cpuidle_disable_device(struct cpuidle_device *dev);
|
||||
extern int cpuidle_wrap_enter(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index,
|
||||
int (*enter)(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index));
|
||||
extern int cpuidle_play_dead(void);
|
||||
|
||||
#else
|
||||
static inline void disable_cpuidle(void) { }
|
||||
|
|
@ -157,6 +167,12 @@ static inline void cpuidle_resume_and_unlock(void) { }
|
|||
static inline int cpuidle_enable_device(struct cpuidle_device *dev)
|
||||
{return -ENODEV; }
|
||||
static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
|
||||
static inline int cpuidle_wrap_enter(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index,
|
||||
int (*enter)(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index))
|
||||
{ return -ENODEV; }
|
||||
static inline int cpuidle_play_dead(void) {return -ENODEV; }
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/threads.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
|
||||
|
||||
|
|
@ -763,12 +764,6 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
|
|||
*
|
||||
*/
|
||||
#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
|
||||
/* These strip const, as traditionally they weren't const. */
|
||||
#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
|
||||
#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
|
||||
#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
|
||||
#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
|
||||
|
||||
#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
|
||||
|
||||
#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
|
||||
|
|
@ -809,11 +804,10 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
|
|||
#else /* NR_CPUS > 1 */
|
||||
int __first_cpu(const cpumask_t *srcp);
|
||||
int __next_cpu(int n, const cpumask_t *srcp);
|
||||
int __any_online_cpu(const cpumask_t *mask);
|
||||
|
||||
#define first_cpu(src) __first_cpu(&(src))
|
||||
#define next_cpu(n, src) __next_cpu((n), &(src))
|
||||
#define any_online_cpu(mask) __any_online_cpu(&(mask))
|
||||
#define any_online_cpu(mask) cpumask_any_and(&mask, cpu_online_mask)
|
||||
#define for_each_cpu_mask(cpu, mask) \
|
||||
for ((cpu) = -1; \
|
||||
(cpu) = next_cpu((cpu), (mask)), \
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ extern int cpuset_init(void);
|
|||
extern void cpuset_init_smp(void);
|
||||
extern void cpuset_update_active_cpus(void);
|
||||
extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
|
||||
extern int cpuset_cpus_allowed_fallback(struct task_struct *p);
|
||||
extern void cpuset_cpus_allowed_fallback(struct task_struct *p);
|
||||
extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
|
||||
#define cpuset_current_mems_allowed (current->mems_allowed)
|
||||
void cpuset_init_current_mems_allowed(void);
|
||||
|
|
@ -135,10 +135,8 @@ static inline void cpuset_cpus_allowed(struct task_struct *p,
|
|||
cpumask_copy(mask, cpu_possible_mask);
|
||||
}
|
||||
|
||||
static inline int cpuset_cpus_allowed_fallback(struct task_struct *p)
|
||||
static inline void cpuset_cpus_allowed_fallback(struct task_struct *p)
|
||||
{
|
||||
do_set_cpus_allowed(p, cpu_possible_mask);
|
||||
return cpumask_any(cpu_active_mask);
|
||||
}
|
||||
|
||||
static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#ifdef CONFIG_CRASH_DUMP
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/elf.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include <linux/atomic.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
|
|
|||
|
|
@ -100,3 +100,6 @@ struct crypto_report_rng {
|
|||
char type[CRYPTO_MAX_NAME];
|
||||
unsigned int seedsize;
|
||||
};
|
||||
|
||||
#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
|
||||
sizeof(struct crypto_report_blkcipher))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <asm/system.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
struct task_struct;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
enum dma_attr {
|
||||
DMA_ATTR_WRITE_BARRIER,
|
||||
DMA_ATTR_WEAK_ORDERING,
|
||||
DMA_ATTR_WRITE_COMBINE,
|
||||
DMA_ATTR_NON_CONSISTENT,
|
||||
DMA_ATTR_MAX,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,12 @@
|
|||
|
||||
#include <linux/file.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
struct device;
|
||||
struct dma_buf;
|
||||
struct dma_buf_attachment;
|
||||
|
||||
|
|
@ -49,6 +50,17 @@ struct dma_buf_attachment;
|
|||
* @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
|
||||
* pages.
|
||||
* @release: release this buffer; to be called after the last dma_buf_put.
|
||||
* @begin_cpu_access: [optional] called before cpu access to invalidate cpu
|
||||
* caches and allocate backing storage (if not yet done)
|
||||
* respectively pin the objet into memory.
|
||||
* @end_cpu_access: [optional] called after cpu access to flush cashes.
|
||||
* @kmap_atomic: maps a page from the buffer into kernel address
|
||||
* space, users may not block until the subsequent unmap call.
|
||||
* This callback must not sleep.
|
||||
* @kunmap_atomic: [optional] unmaps a atomically mapped page from the buffer.
|
||||
* This Callback must not sleep.
|
||||
* @kmap: maps a page from the buffer into kernel address space.
|
||||
* @kunmap: [optional] unmaps a page from the buffer.
|
||||
*/
|
||||
struct dma_buf_ops {
|
||||
int (*attach)(struct dma_buf *, struct device *,
|
||||
|
|
@ -63,7 +75,8 @@ struct dma_buf_ops {
|
|||
struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
|
||||
enum dma_data_direction);
|
||||
void (*unmap_dma_buf)(struct dma_buf_attachment *,
|
||||
struct sg_table *);
|
||||
struct sg_table *,
|
||||
enum dma_data_direction);
|
||||
/* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
|
||||
* if the call would block.
|
||||
*/
|
||||
|
|
@ -71,6 +84,14 @@ struct dma_buf_ops {
|
|||
/* after final dma_buf_put() */
|
||||
void (*release)(struct dma_buf *);
|
||||
|
||||
int (*begin_cpu_access)(struct dma_buf *, size_t, size_t,
|
||||
enum dma_data_direction);
|
||||
void (*end_cpu_access)(struct dma_buf *, size_t, size_t,
|
||||
enum dma_data_direction);
|
||||
void *(*kmap_atomic)(struct dma_buf *, unsigned long);
|
||||
void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *);
|
||||
void *(*kmap)(struct dma_buf *, unsigned long);
|
||||
void (*kunmap)(struct dma_buf *, unsigned long, void *);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -86,7 +107,7 @@ struct dma_buf {
|
|||
struct file *file;
|
||||
struct list_head attachments;
|
||||
const struct dma_buf_ops *ops;
|
||||
/* mutex to serialize list manipulation and other ops */
|
||||
/* mutex to serialize list manipulation and attach/detach */
|
||||
struct mutex lock;
|
||||
void *priv;
|
||||
};
|
||||
|
|
@ -109,20 +130,43 @@ struct dma_buf_attachment {
|
|||
void *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* get_dma_buf - convenience wrapper for get_file.
|
||||
* @dmabuf: [in] pointer to dma_buf
|
||||
*
|
||||
* Increments the reference count on the dma-buf, needed in case of drivers
|
||||
* that either need to create additional references to the dmabuf on the
|
||||
* kernel side. For example, an exporter that needs to keep a dmabuf ptr
|
||||
* so that subsequent exports don't create a new dmabuf.
|
||||
*/
|
||||
static inline void get_dma_buf(struct dma_buf *dmabuf)
|
||||
{
|
||||
get_file(dmabuf->file);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DMA_SHARED_BUFFER
|
||||
struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
||||
struct device *dev);
|
||||
void dma_buf_detach(struct dma_buf *dmabuf,
|
||||
struct dma_buf_attachment *dmabuf_attach);
|
||||
struct dma_buf *dma_buf_export(void *priv, struct dma_buf_ops *ops,
|
||||
size_t size, int flags);
|
||||
int dma_buf_fd(struct dma_buf *dmabuf);
|
||||
struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops,
|
||||
size_t size, int flags);
|
||||
int dma_buf_fd(struct dma_buf *dmabuf, int flags);
|
||||
struct dma_buf *dma_buf_get(int fd);
|
||||
void dma_buf_put(struct dma_buf *dmabuf);
|
||||
|
||||
struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
|
||||
enum dma_data_direction);
|
||||
void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *);
|
||||
void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *,
|
||||
enum dma_data_direction);
|
||||
int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, size_t start, size_t len,
|
||||
enum dma_data_direction dir);
|
||||
void dma_buf_end_cpu_access(struct dma_buf *dma_buf, size_t start, size_t len,
|
||||
enum dma_data_direction dir);
|
||||
void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long);
|
||||
void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);
|
||||
void *dma_buf_kmap(struct dma_buf *, unsigned long);
|
||||
void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);
|
||||
#else
|
||||
|
||||
static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
||||
|
|
@ -138,13 +182,13 @@ static inline void dma_buf_detach(struct dma_buf *dmabuf,
|
|||
}
|
||||
|
||||
static inline struct dma_buf *dma_buf_export(void *priv,
|
||||
struct dma_buf_ops *ops,
|
||||
size_t size, int flags)
|
||||
const struct dma_buf_ops *ops,
|
||||
size_t size, int flags)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline int dma_buf_fd(struct dma_buf *dmabuf)
|
||||
static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
@ -166,11 +210,44 @@ static inline struct sg_table *dma_buf_map_attachment(
|
|||
}
|
||||
|
||||
static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
|
||||
struct sg_table *sg)
|
||||
struct sg_table *sg, enum dma_data_direction dir)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
|
||||
size_t start, size_t len,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline void dma_buf_end_cpu_access(struct dma_buf *dmabuf,
|
||||
size_t start, size_t len,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void *dma_buf_kmap_atomic(struct dma_buf *dmabuf,
|
||||
unsigned long pnum)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void dma_buf_kunmap_atomic(struct dma_buf *dmabuf,
|
||||
unsigned long pnum, void *vaddr)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long pnum)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void dma_buf_kunmap(struct dma_buf *dmabuf,
|
||||
unsigned long pnum, void *vaddr)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_DMA_SHARED_BUFFER */
|
||||
|
||||
#endif /* __DMA_BUF_H__ */
|
||||
|
|
|
|||
|
|
@ -9,10 +9,15 @@
|
|||
#include <linux/scatterlist.h>
|
||||
|
||||
struct dma_map_ops {
|
||||
void* (*alloc_coherent)(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t gfp);
|
||||
void (*free_coherent)(struct device *dev, size_t size,
|
||||
void *vaddr, dma_addr_t dma_handle);
|
||||
void* (*alloc)(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t gfp,
|
||||
struct dma_attrs *attrs);
|
||||
void (*free)(struct device *dev, size_t size,
|
||||
void *vaddr, dma_addr_t dma_handle,
|
||||
struct dma_attrs *attrs);
|
||||
int (*mmap)(struct device *, struct vm_area_struct *,
|
||||
void *, dma_addr_t, size_t, struct dma_attrs *attrs);
|
||||
|
||||
dma_addr_t (*map_page)(struct device *dev, struct page *page,
|
||||
unsigned long offset, size_t size,
|
||||
enum dma_data_direction dir,
|
||||
|
|
@ -77,7 +82,7 @@ static inline u64 dma_get_mask(struct device *dev)
|
|||
return DMA_BIT_MASK(32);
|
||||
}
|
||||
|
||||
#ifdef ARCH_HAS_DMA_SET_COHERENT_MASK
|
||||
#ifdef CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK
|
||||
int dma_set_coherent_mask(struct device *dev, u64 mask);
|
||||
#else
|
||||
static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
|
||||
|
|
|
|||
|
|
@ -18,13 +18,15 @@
|
|||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called COPYING.
|
||||
*/
|
||||
#ifndef DMAENGINE_H
|
||||
#define DMAENGINE_H
|
||||
#ifndef LINUX_DMAENGINE_H
|
||||
#define LINUX_DMAENGINE_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
/**
|
||||
|
|
@ -257,6 +259,7 @@ struct dma_chan_percpu {
|
|||
* struct dma_chan - devices supply DMA channels, clients use them
|
||||
* @device: ptr to the dma device who supplies this channel, always !%NULL
|
||||
* @cookie: last cookie value returned to client
|
||||
* @completed_cookie: last completed cookie for this channel
|
||||
* @chan_id: channel ID for sysfs
|
||||
* @dev: class device for sysfs
|
||||
* @device_node: used to add this to the device chan list
|
||||
|
|
@ -268,6 +271,7 @@ struct dma_chan_percpu {
|
|||
struct dma_chan {
|
||||
struct dma_device *device;
|
||||
dma_cookie_t cookie;
|
||||
dma_cookie_t completed_cookie;
|
||||
|
||||
/* sysfs */
|
||||
int chan_id;
|
||||
|
|
@ -331,6 +335,9 @@ enum dma_slave_buswidth {
|
|||
* may or may not be applicable on memory sources.
|
||||
* @dst_maxburst: same as src_maxburst but for destination target
|
||||
* mutatis mutandis.
|
||||
* @device_fc: Flow Controller Settings. Only valid for slave channels. Fill
|
||||
* with 'true' if peripheral should be flow controller. Direction will be
|
||||
* selected at Runtime.
|
||||
*
|
||||
* This struct is passed in as configuration data to a DMA engine
|
||||
* in order to set up a certain channel for DMA transport at runtime.
|
||||
|
|
@ -357,6 +364,7 @@ struct dma_slave_config {
|
|||
enum dma_slave_buswidth dst_addr_width;
|
||||
u32 src_maxburst;
|
||||
u32 dst_maxburst;
|
||||
bool device_fc;
|
||||
};
|
||||
|
||||
static inline const char *dma_chan_name(struct dma_chan *chan)
|
||||
|
|
@ -575,10 +583,11 @@ struct dma_device {
|
|||
struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
|
||||
struct dma_chan *chan, struct scatterlist *sgl,
|
||||
unsigned int sg_len, enum dma_transfer_direction direction,
|
||||
unsigned long flags);
|
||||
unsigned long flags, void *context);
|
||||
struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
|
||||
struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
|
||||
size_t period_len, enum dma_transfer_direction direction);
|
||||
size_t period_len, enum dma_transfer_direction direction,
|
||||
void *context);
|
||||
struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
|
||||
struct dma_chan *chan, struct dma_interleaved_template *xt,
|
||||
unsigned long flags);
|
||||
|
|
@ -612,7 +621,24 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
|
|||
struct scatterlist sg;
|
||||
sg_init_one(&sg, buf, len);
|
||||
|
||||
return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags);
|
||||
return chan->device->device_prep_slave_sg(chan, &sg, 1,
|
||||
dir, flags, NULL);
|
||||
}
|
||||
|
||||
static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
|
||||
struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
|
||||
enum dma_transfer_direction dir, unsigned long flags)
|
||||
{
|
||||
return chan->device->device_prep_slave_sg(chan, sgl, sg_len,
|
||||
dir, flags, NULL);
|
||||
}
|
||||
|
||||
static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
|
||||
struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
|
||||
size_t period_len, enum dma_transfer_direction dir)
|
||||
{
|
||||
return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
|
||||
period_len, dir, NULL);
|
||||
}
|
||||
|
||||
static inline int dmaengine_terminate_all(struct dma_chan *chan)
|
||||
|
|
@ -948,6 +974,7 @@ int dma_async_device_register(struct dma_device *device);
|
|||
void dma_async_device_unregister(struct dma_device *device);
|
||||
void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
|
||||
struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
|
||||
struct dma_chan *net_dma_find_channel(void);
|
||||
#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
|
||||
|
||||
/* --- Helper iov-locking functions --- */
|
||||
|
|
|
|||
|
|
@ -31,18 +31,6 @@ struct dw_dma_platform_data {
|
|||
unsigned char chan_priority;
|
||||
};
|
||||
|
||||
/**
|
||||
* enum dw_dma_slave_width - DMA slave register access width.
|
||||
* @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
|
||||
* @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
|
||||
* @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
|
||||
*/
|
||||
enum dw_dma_slave_width {
|
||||
DW_DMA_SLAVE_WIDTH_8BIT,
|
||||
DW_DMA_SLAVE_WIDTH_16BIT,
|
||||
DW_DMA_SLAVE_WIDTH_32BIT,
|
||||
};
|
||||
|
||||
/* bursts size */
|
||||
enum dw_dma_msize {
|
||||
DW_DMA_MSIZE_1,
|
||||
|
|
@ -55,47 +43,21 @@ enum dw_dma_msize {
|
|||
DW_DMA_MSIZE_256,
|
||||
};
|
||||
|
||||
/* flow controller */
|
||||
enum dw_dma_fc {
|
||||
DW_DMA_FC_D_M2M,
|
||||
DW_DMA_FC_D_M2P,
|
||||
DW_DMA_FC_D_P2M,
|
||||
DW_DMA_FC_D_P2P,
|
||||
DW_DMA_FC_P_P2M,
|
||||
DW_DMA_FC_SP_P2P,
|
||||
DW_DMA_FC_P_M2P,
|
||||
DW_DMA_FC_DP_P2P,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dw_dma_slave - Controller-specific information about a slave
|
||||
*
|
||||
* @dma_dev: required DMA master device
|
||||
* @tx_reg: physical address of data register used for
|
||||
* memory-to-peripheral transfers
|
||||
* @rx_reg: physical address of data register used for
|
||||
* peripheral-to-memory transfers
|
||||
* @reg_width: peripheral register width
|
||||
* @cfg_hi: Platform-specific initializer for the CFG_HI register
|
||||
* @cfg_lo: Platform-specific initializer for the CFG_LO register
|
||||
* @src_master: src master for transfers on allocated channel.
|
||||
* @dst_master: dest master for transfers on allocated channel.
|
||||
* @src_msize: src burst size.
|
||||
* @dst_msize: dest burst size.
|
||||
* @fc: flow controller for DMA transfer
|
||||
*/
|
||||
struct dw_dma_slave {
|
||||
struct device *dma_dev;
|
||||
dma_addr_t tx_reg;
|
||||
dma_addr_t rx_reg;
|
||||
enum dw_dma_slave_width reg_width;
|
||||
u32 cfg_hi;
|
||||
u32 cfg_lo;
|
||||
u8 src_master;
|
||||
u8 dst_master;
|
||||
u8 src_msize;
|
||||
u8 dst_msize;
|
||||
u8 fc;
|
||||
};
|
||||
|
||||
/* Platform-configurable bits in CFG_HI */
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@
|
|||
#define _LINUX_EDAC_H_
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
struct device;
|
||||
|
||||
#define EDAC_OPSTATE_INVAL -1
|
||||
#define EDAC_OPSTATE_POLL 0
|
||||
|
|
@ -66,25 +70,64 @@ enum dev_type {
|
|||
#define DEV_FLAG_X32 BIT(DEV_X32)
|
||||
#define DEV_FLAG_X64 BIT(DEV_X64)
|
||||
|
||||
/* memory types */
|
||||
/**
|
||||
* enum mem_type - memory types. For a more detailed reference, please see
|
||||
* http://en.wikipedia.org/wiki/DRAM
|
||||
*
|
||||
* @MEM_EMPTY Empty csrow
|
||||
* @MEM_RESERVED: Reserved csrow type
|
||||
* @MEM_UNKNOWN: Unknown csrow type
|
||||
* @MEM_FPM: FPM - Fast Page Mode, used on systems up to 1995.
|
||||
* @MEM_EDO: EDO - Extended data out, used on systems up to 1998.
|
||||
* @MEM_BEDO: BEDO - Burst Extended data out, an EDO variant.
|
||||
* @MEM_SDR: SDR - Single data rate SDRAM
|
||||
* http://en.wikipedia.org/wiki/Synchronous_dynamic_random-access_memory
|
||||
* They use 3 pins for chip select: Pins 0 and 2 are
|
||||
* for rank 0; pins 1 and 3 are for rank 1, if the memory
|
||||
* is dual-rank.
|
||||
* @MEM_RDR: Registered SDR SDRAM
|
||||
* @MEM_DDR: Double data rate SDRAM
|
||||
* http://en.wikipedia.org/wiki/DDR_SDRAM
|
||||
* @MEM_RDDR: Registered Double data rate SDRAM
|
||||
* This is a variant of the DDR memories.
|
||||
* A registered memory has a buffer inside it, hiding
|
||||
* part of the memory details to the memory controller.
|
||||
* @MEM_RMBS: Rambus DRAM, used on a few Pentium III/IV controllers.
|
||||
* @MEM_DDR2: DDR2 RAM, as described at JEDEC JESD79-2F.
|
||||
* Those memories are labed as "PC2-" instead of "PC" to
|
||||
* differenciate from DDR.
|
||||
* @MEM_FB_DDR2: Fully-Buffered DDR2, as described at JEDEC Std No. 205
|
||||
* and JESD206.
|
||||
* Those memories are accessed per DIMM slot, and not by
|
||||
* a chip select signal.
|
||||
* @MEM_RDDR2: Registered DDR2 RAM
|
||||
* This is a variant of the DDR2 memories.
|
||||
* @MEM_XDR: Rambus XDR
|
||||
* It is an evolution of the original RAMBUS memories,
|
||||
* created to compete with DDR2. Weren't used on any
|
||||
* x86 arch, but cell_edac PPC memory controller uses it.
|
||||
* @MEM_DDR3: DDR3 RAM
|
||||
* @MEM_RDDR3: Registered DDR3 RAM
|
||||
* This is a variant of the DDR3 memories.
|
||||
*/
|
||||
enum mem_type {
|
||||
MEM_EMPTY = 0, /* Empty csrow */
|
||||
MEM_RESERVED, /* Reserved csrow type */
|
||||
MEM_UNKNOWN, /* Unknown csrow type */
|
||||
MEM_FPM, /* Fast page mode */
|
||||
MEM_EDO, /* Extended data out */
|
||||
MEM_BEDO, /* Burst Extended data out */
|
||||
MEM_SDR, /* Single data rate SDRAM */
|
||||
MEM_RDR, /* Registered single data rate SDRAM */
|
||||
MEM_DDR, /* Double data rate SDRAM */
|
||||
MEM_RDDR, /* Registered Double data rate SDRAM */
|
||||
MEM_RMBS, /* Rambus DRAM */
|
||||
MEM_DDR2, /* DDR2 RAM */
|
||||
MEM_FB_DDR2, /* fully buffered DDR2 */
|
||||
MEM_RDDR2, /* Registered DDR2 RAM */
|
||||
MEM_XDR, /* Rambus XDR */
|
||||
MEM_DDR3, /* DDR3 RAM */
|
||||
MEM_RDDR3, /* Registered DDR3 RAM */
|
||||
MEM_EMPTY = 0,
|
||||
MEM_RESERVED,
|
||||
MEM_UNKNOWN,
|
||||
MEM_FPM,
|
||||
MEM_EDO,
|
||||
MEM_BEDO,
|
||||
MEM_SDR,
|
||||
MEM_RDR,
|
||||
MEM_DDR,
|
||||
MEM_RDDR,
|
||||
MEM_RMBS,
|
||||
MEM_DDR2,
|
||||
MEM_FB_DDR2,
|
||||
MEM_RDDR2,
|
||||
MEM_XDR,
|
||||
MEM_DDR3,
|
||||
MEM_RDDR3,
|
||||
};
|
||||
|
||||
#define MEM_FLAG_EMPTY BIT(MEM_EMPTY)
|
||||
|
|
@ -162,8 +205,9 @@ enum scrub_type {
|
|||
#define OP_OFFLINE 0x300
|
||||
|
||||
/*
|
||||
* There are several things to be aware of that aren't at all obvious:
|
||||
* Concepts used at the EDAC subsystem
|
||||
*
|
||||
* There are several things to be aware of that aren't at all obvious:
|
||||
*
|
||||
* SOCKETS, SOCKET SETS, BANKS, ROWS, CHIP-SELECT ROWS, CHANNELS, etc..
|
||||
*
|
||||
|
|
@ -172,36 +216,61 @@ enum scrub_type {
|
|||
* creating a common ground for discussion, terms and their definitions
|
||||
* will be established.
|
||||
*
|
||||
* Memory devices: The individual chip on a memory stick. These devices
|
||||
* commonly output 4 and 8 bits each. Grouping several
|
||||
* of these in parallel provides 64 bits which is common
|
||||
* for a memory stick.
|
||||
* Memory devices: The individual DRAM chips on a memory stick. These
|
||||
* devices commonly output 4 and 8 bits each (x4, x8).
|
||||
* Grouping several of these in parallel provides the
|
||||
* number of bits that the memory controller expects:
|
||||
* typically 72 bits, in order to provide 64 bits +
|
||||
* 8 bits of ECC data.
|
||||
*
|
||||
* Memory Stick: A printed circuit board that aggregates multiple
|
||||
* memory devices in parallel. This is the atomic
|
||||
* memory component that is purchaseable by Joe consumer
|
||||
* and loaded into a memory socket.
|
||||
* memory devices in parallel. In general, this is the
|
||||
* Field Replaceable Unit (FRU) which gets replaced, in
|
||||
* the case of excessive errors. Most often it is also
|
||||
* called DIMM (Dual Inline Memory Module).
|
||||
*
|
||||
* Socket: A physical connector on the motherboard that accepts
|
||||
* a single memory stick.
|
||||
* Memory Socket: A physical connector on the motherboard that accepts
|
||||
* a single memory stick. Also called as "slot" on several
|
||||
* datasheets.
|
||||
*
|
||||
* Channel: Set of memory devices on a memory stick that must be
|
||||
* grouped in parallel with one or more additional
|
||||
* channels from other memory sticks. This parallel
|
||||
* grouping of the output from multiple channels are
|
||||
* necessary for the smallest granularity of memory access.
|
||||
* Some memory controllers are capable of single channel -
|
||||
* which means that memory sticks can be loaded
|
||||
* individually. Other memory controllers are only
|
||||
* capable of dual channel - which means that memory
|
||||
* sticks must be loaded as pairs (see "socket set").
|
||||
* Channel: A memory controller channel, responsible to communicate
|
||||
* with a group of DIMMs. Each channel has its own
|
||||
* independent control (command) and data bus, and can
|
||||
* be used independently or grouped with other channels.
|
||||
*
|
||||
* Chip-select row: All of the memory devices that are selected together.
|
||||
* for a single, minimum grain of memory access.
|
||||
* This selects all of the parallel memory devices across
|
||||
* all of the parallel channels. Common chip-select rows
|
||||
* for single channel are 64 bits, for dual channel 128
|
||||
* bits.
|
||||
* Branch: It is typically the highest hierarchy on a
|
||||
* Fully-Buffered DIMM memory controller.
|
||||
* Typically, it contains two channels.
|
||||
* Two channels at the same branch can be used in single
|
||||
* mode or in lockstep mode.
|
||||
* When lockstep is enabled, the cacheline is doubled,
|
||||
* but it generally brings some performance penalty.
|
||||
* Also, it is generally not possible to point to just one
|
||||
* memory stick when an error occurs, as the error
|
||||
* correction code is calculated using two DIMMs instead
|
||||
* of one. Due to that, it is capable of correcting more
|
||||
* errors than on single mode.
|
||||
*
|
||||
* Single-channel: The data accessed by the memory controller is contained
|
||||
* into one dimm only. E. g. if the data is 64 bits-wide,
|
||||
* the data flows to the CPU using one 64 bits parallel
|
||||
* access.
|
||||
* Typically used with SDR, DDR, DDR2 and DDR3 memories.
|
||||
* FB-DIMM and RAMBUS use a different concept for channel,
|
||||
* so this concept doesn't apply there.
|
||||
*
|
||||
* Double-channel: The data size accessed by the memory controller is
|
||||
* interlaced into two dimms, accessed at the same time.
|
||||
* E. g. if the DIMM is 64 bits-wide (72 bits with ECC),
|
||||
* the data flows to the CPU using a 128 bits parallel
|
||||
* access.
|
||||
*
|
||||
* Chip-select row: This is the name of the DRAM signal used to select the
|
||||
* DRAM ranks to be accessed. Common chip-select rows for
|
||||
* single channel are 64 bits, for dual channel 128 bits.
|
||||
* It may not be visible by the memory controller, as some
|
||||
* DIMM types have a memory buffer that can hide direct
|
||||
* access to it from the Memory Controller.
|
||||
*
|
||||
* Single-Ranked stick: A Single-ranked stick has 1 chip-select row of memory.
|
||||
* Motherboards commonly drive two chip-select pins to
|
||||
|
|
@ -214,8 +283,8 @@ enum scrub_type {
|
|||
*
|
||||
* Double-sided stick: DEPRECATED TERM, see Double-Ranked stick.
|
||||
* A double-sided stick has two chip-select rows which
|
||||
* access different sets of memory devices. The two
|
||||
* rows cannot be accessed concurrently. "Double-sided"
|
||||
* access different sets of memory devices. The two
|
||||
* rows cannot be accessed concurrently. "Double-sided"
|
||||
* is irrespective of the memory devices being mounted
|
||||
* on both sides of the memory stick.
|
||||
*
|
||||
|
|
@ -243,10 +312,22 @@ enum scrub_type {
|
|||
* PS - I enjoyed writing all that about as much as you enjoyed reading it.
|
||||
*/
|
||||
|
||||
struct channel_info {
|
||||
int chan_idx; /* channel index */
|
||||
u32 ce_count; /* Correctable Errors for this CHANNEL */
|
||||
char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */
|
||||
/**
|
||||
* struct rank_info - contains the information for one DIMM rank
|
||||
*
|
||||
* @chan_idx: channel number where the rank is (typically, 0 or 1)
|
||||
* @ce_count: number of correctable errors for this rank
|
||||
* @label: DIMM label. Different ranks for the same DIMM should be
|
||||
* filled, on userspace, with the same label.
|
||||
* FIXME: The core currently won't enforce it.
|
||||
* @csrow: A pointer to the chip select row structure (the parent
|
||||
* structure). The location of the rank is given by
|
||||
* the (csrow->csrow_idx, chan_idx) vector.
|
||||
*/
|
||||
struct rank_info {
|
||||
int chan_idx;
|
||||
u32 ce_count;
|
||||
char label[EDAC_MC_LABEL_LEN + 1];
|
||||
struct csrow_info *csrow; /* the parent */
|
||||
};
|
||||
|
||||
|
|
@ -270,7 +351,7 @@ struct csrow_info {
|
|||
|
||||
/* channel information for this csrow */
|
||||
u32 nr_channels;
|
||||
struct channel_info *channels;
|
||||
struct rank_info *channels;
|
||||
};
|
||||
|
||||
struct mcidev_sysfs_group {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include <linux/pstore.h>
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
#define EFI_SUCCESS 0
|
||||
#define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1)))
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <linux/time.h>
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/user.h>
|
||||
#include <linux/bug.h>
|
||||
#endif
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/elf.h>
|
||||
|
|
|
|||
|
|
@ -896,8 +896,7 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
|
|||
*
|
||||
* All operations are optional (i.e. the function pointer may be set
|
||||
* to %NULL) and callers must take this into account. Callers must
|
||||
* hold the RTNL, except that for @get_drvinfo the caller may or may
|
||||
* not hold the RTNL.
|
||||
* hold the RTNL lock.
|
||||
*
|
||||
* See the structures used by these operations for further documentation.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,574 +18,25 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
#include <linux/magic.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
/*
|
||||
* The second extended filesystem constants/structures
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define EXT2FS_DEBUG to produce debug messages
|
||||
*/
|
||||
#undef EXT2FS_DEBUG
|
||||
|
||||
/*
|
||||
* Define EXT2_RESERVATION to reserve data blocks for expanding files
|
||||
*/
|
||||
#define EXT2_DEFAULT_RESERVE_BLOCKS 8
|
||||
/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
|
||||
#define EXT2_MAX_RESERVE_BLOCKS 1027
|
||||
#define EXT2_RESERVE_WINDOW_NOT_ALLOCATED 0
|
||||
/*
|
||||
* The second extended file system version
|
||||
*/
|
||||
#define EXT2FS_DATE "95/08/09"
|
||||
#define EXT2FS_VERSION "0.5b"
|
||||
|
||||
/*
|
||||
* Debug code
|
||||
*/
|
||||
#ifdef EXT2FS_DEBUG
|
||||
# define ext2_debug(f, a...) { \
|
||||
printk ("EXT2-fs DEBUG (%s, %d): %s:", \
|
||||
__FILE__, __LINE__, __func__); \
|
||||
printk (f, ## a); \
|
||||
}
|
||||
#else
|
||||
# define ext2_debug(f, a...) /**/
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Special inode numbers
|
||||
*/
|
||||
#define EXT2_BAD_INO 1 /* Bad blocks inode */
|
||||
#define EXT2_ROOT_INO 2 /* Root inode */
|
||||
#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
|
||||
#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
|
||||
|
||||
/* First non-reserved inode for old ext2 filesystems */
|
||||
#define EXT2_GOOD_OLD_FIRST_INO 11
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/ext2_fs_sb.h>
|
||||
static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
|
||||
{
|
||||
return sb->s_fs_info;
|
||||
}
|
||||
#else
|
||||
/* Assume that user mode programs are passing in an ext2fs superblock, not
|
||||
* a kernel struct super_block. This will allow us to call the feature-test
|
||||
* macros from user land. */
|
||||
#define EXT2_SB(sb) (sb)
|
||||
#endif
|
||||
#define EXT2_NAME_LEN 255
|
||||
|
||||
/*
|
||||
* Maximal count of links to a file
|
||||
*/
|
||||
#define EXT2_LINK_MAX 32000
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage several block sizes
|
||||
*/
|
||||
#define EXT2_MIN_BLOCK_SIZE 1024
|
||||
#define EXT2_MAX_BLOCK_SIZE 4096
|
||||
#define EXT2_MIN_BLOCK_LOG_SIZE 10
|
||||
#ifdef __KERNEL__
|
||||
# define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
|
||||
#else
|
||||
# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
|
||||
#endif
|
||||
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
|
||||
#ifdef __KERNEL__
|
||||
# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
|
||||
#else
|
||||
# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
|
||||
#endif
|
||||
#ifdef __KERNEL__
|
||||
#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits)
|
||||
#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
|
||||
#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino)
|
||||
#else
|
||||
#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
|
||||
EXT2_GOOD_OLD_INODE_SIZE : \
|
||||
(s)->s_inode_size)
|
||||
#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
|
||||
EXT2_GOOD_OLD_FIRST_INO : \
|
||||
(s)->s_first_ino)
|
||||
#endif
|
||||
#define EXT2_SB_MAGIC_OFFSET 0x38
|
||||
#define EXT2_SB_BLOCKS_OFFSET 0x04
|
||||
#define EXT2_SB_BSIZE_OFFSET 0x18
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage fragments
|
||||
*/
|
||||
#define EXT2_MIN_FRAG_SIZE 1024
|
||||
#define EXT2_MAX_FRAG_SIZE 4096
|
||||
#define EXT2_MIN_FRAG_LOG_SIZE 10
|
||||
#ifdef __KERNEL__
|
||||
# define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->s_frag_size)
|
||||
# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->s_frags_per_block)
|
||||
#else
|
||||
# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
|
||||
# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure of a blocks group descriptor
|
||||
*/
|
||||
struct ext2_group_desc
|
||||
static inline u64 ext2_image_size(void *ext2_sb)
|
||||
{
|
||||
__le32 bg_block_bitmap; /* Blocks bitmap block */
|
||||
__le32 bg_inode_bitmap; /* Inodes bitmap block */
|
||||
__le32 bg_inode_table; /* Inodes table block */
|
||||
__le16 bg_free_blocks_count; /* Free blocks count */
|
||||
__le16 bg_free_inodes_count; /* Free inodes count */
|
||||
__le16 bg_used_dirs_count; /* Directories count */
|
||||
__le16 bg_pad;
|
||||
__le32 bg_reserved[3];
|
||||
};
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage group descriptors
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
# define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
|
||||
# define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block)
|
||||
# define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
|
||||
# define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
|
||||
#else
|
||||
# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
|
||||
# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
|
||||
# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Constants relative to the data blocks
|
||||
*/
|
||||
#define EXT2_NDIR_BLOCKS 12
|
||||
#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
|
||||
#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
|
||||
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
|
||||
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
|
||||
|
||||
/*
|
||||
* Inode flags (GETFLAGS/SETFLAGS)
|
||||
*/
|
||||
#define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */
|
||||
#define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */
|
||||
#define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */
|
||||
#define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
|
||||
#define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
|
||||
#define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
|
||||
#define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
|
||||
#define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
|
||||
/* Reserved for compression usage... */
|
||||
#define EXT2_DIRTY_FL FS_DIRTY_FL
|
||||
#define EXT2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */
|
||||
#define EXT2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */
|
||||
#define EXT2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */
|
||||
/* End compression flags --- maybe not all used */
|
||||
#define EXT2_BTREE_FL FS_BTREE_FL /* btree format dir */
|
||||
#define EXT2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */
|
||||
#define EXT2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */
|
||||
#define EXT2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */
|
||||
#define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
|
||||
#define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
|
||||
#define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
|
||||
#define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
|
||||
|
||||
#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
|
||||
#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
|
||||
|
||||
/* Flags that should be inherited by new inodes from their parent. */
|
||||
#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
|
||||
EXT2_SYNC_FL | EXT2_NODUMP_FL |\
|
||||
EXT2_NOATIME_FL | EXT2_COMPRBLK_FL |\
|
||||
EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\
|
||||
EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
|
||||
|
||||
/* Flags that are appropriate for regular files (all but dir-specific ones). */
|
||||
#define EXT2_REG_FLMASK (~(EXT2_DIRSYNC_FL | EXT2_TOPDIR_FL))
|
||||
|
||||
/* Flags that are appropriate for non-directories/regular files. */
|
||||
#define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL)
|
||||
|
||||
/* Mask out flags that are inappropriate for the given type of inode. */
|
||||
static inline __u32 ext2_mask_flags(umode_t mode, __u32 flags)
|
||||
{
|
||||
if (S_ISDIR(mode))
|
||||
return flags;
|
||||
else if (S_ISREG(mode))
|
||||
return flags & EXT2_REG_FLMASK;
|
||||
else
|
||||
return flags & EXT2_OTHER_FLMASK;
|
||||
__u8 *p = ext2_sb;
|
||||
if (*(__le16 *)(p + EXT2_SB_MAGIC_OFFSET) != cpu_to_le16(EXT2_SUPER_MAGIC))
|
||||
return 0;
|
||||
return (u64)le32_to_cpup((__le32 *)(p + EXT2_SB_BLOCKS_OFFSET)) <<
|
||||
le32_to_cpup((__le32 *)(p + EXT2_SB_BSIZE_OFFSET));
|
||||
}
|
||||
|
||||
/*
|
||||
* ioctl commands
|
||||
*/
|
||||
#define EXT2_IOC_GETFLAGS FS_IOC_GETFLAGS
|
||||
#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS
|
||||
#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION
|
||||
#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION
|
||||
#define EXT2_IOC_GETRSVSZ _IOR('f', 5, long)
|
||||
#define EXT2_IOC_SETRSVSZ _IOW('f', 6, long)
|
||||
|
||||
/*
|
||||
* ioctl commands in 32 bit emulation
|
||||
*/
|
||||
#define EXT2_IOC32_GETFLAGS FS_IOC32_GETFLAGS
|
||||
#define EXT2_IOC32_SETFLAGS FS_IOC32_SETFLAGS
|
||||
#define EXT2_IOC32_GETVERSION FS_IOC32_GETVERSION
|
||||
#define EXT2_IOC32_SETVERSION FS_IOC32_SETVERSION
|
||||
|
||||
/*
|
||||
* Structure of an inode on the disk
|
||||
*/
|
||||
struct ext2_inode {
|
||||
__le16 i_mode; /* File mode */
|
||||
__le16 i_uid; /* Low 16 bits of Owner Uid */
|
||||
__le32 i_size; /* Size in bytes */
|
||||
__le32 i_atime; /* Access time */
|
||||
__le32 i_ctime; /* Creation 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_flags; /* File flags */
|
||||
union {
|
||||
struct {
|
||||
__le32 l_i_reserved1;
|
||||
} linux1;
|
||||
struct {
|
||||
__le32 h_i_translator;
|
||||
} hurd1;
|
||||
struct {
|
||||
__le32 m_i_reserved1;
|
||||
} masix1;
|
||||
} osd1; /* OS dependent 1 */
|
||||
__le32 i_block[EXT2_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_faddr; /* Fragment address */
|
||||
union {
|
||||
struct {
|
||||
__u8 l_i_frag; /* Fragment number */
|
||||
__u8 l_i_fsize; /* Fragment size */
|
||||
__u16 i_pad1;
|
||||
__le16 l_i_uid_high; /* these 2 fields */
|
||||
__le16 l_i_gid_high; /* were reserved2[0] */
|
||||
__u32 l_i_reserved2;
|
||||
} linux2;
|
||||
struct {
|
||||
__u8 h_i_frag; /* Fragment number */
|
||||
__u8 h_i_fsize; /* Fragment size */
|
||||
__le16 h_i_mode_high;
|
||||
__le16 h_i_uid_high;
|
||||
__le16 h_i_gid_high;
|
||||
__le32 h_i_author;
|
||||
} hurd2;
|
||||
struct {
|
||||
__u8 m_i_frag; /* Fragment number */
|
||||
__u8 m_i_fsize; /* Fragment size */
|
||||
__u16 m_pad1;
|
||||
__u32 m_i_reserved2[2];
|
||||
} masix2;
|
||||
} osd2; /* OS dependent 2 */
|
||||
};
|
||||
|
||||
#define i_size_high i_dir_acl
|
||||
|
||||
#if defined(__KERNEL__) || defined(__linux__)
|
||||
#define i_reserved1 osd1.linux1.l_i_reserved1
|
||||
#define i_frag osd2.linux2.l_i_frag
|
||||
#define i_fsize osd2.linux2.l_i_fsize
|
||||
#define i_uid_low i_uid
|
||||
#define i_gid_low i_gid
|
||||
#define i_uid_high osd2.linux2.l_i_uid_high
|
||||
#define i_gid_high osd2.linux2.l_i_gid_high
|
||||
#define i_reserved2 osd2.linux2.l_i_reserved2
|
||||
#endif
|
||||
|
||||
#ifdef __hurd__
|
||||
#define i_translator osd1.hurd1.h_i_translator
|
||||
#define i_frag osd2.hurd2.h_i_frag
|
||||
#define i_fsize osd2.hurd2.h_i_fsize
|
||||
#define i_uid_high osd2.hurd2.h_i_uid_high
|
||||
#define i_gid_high osd2.hurd2.h_i_gid_high
|
||||
#define i_author osd2.hurd2.h_i_author
|
||||
#endif
|
||||
|
||||
#ifdef __masix__
|
||||
#define i_reserved1 osd1.masix1.m_i_reserved1
|
||||
#define i_frag osd2.masix2.m_i_frag
|
||||
#define i_fsize osd2.masix2.m_i_fsize
|
||||
#define i_reserved2 osd2.masix2.m_i_reserved2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* File system states
|
||||
*/
|
||||
#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
|
||||
#define EXT2_ERROR_FS 0x0002 /* Errors detected */
|
||||
|
||||
/*
|
||||
* Mount flags
|
||||
*/
|
||||
#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */
|
||||
#define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */
|
||||
#define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */
|
||||
#define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */
|
||||
#define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */
|
||||
#define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */
|
||||
#define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */
|
||||
#define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */
|
||||
#define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */
|
||||
#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */
|
||||
#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
|
||||
#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
|
||||
#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */
|
||||
#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
|
||||
#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
|
||||
#define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
|
||||
|
||||
|
||||
#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
|
||||
#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
|
||||
#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
|
||||
EXT2_MOUNT_##opt)
|
||||
/*
|
||||
* Maximal mount counts between two filesystem checks
|
||||
*/
|
||||
#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
|
||||
#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
|
||||
|
||||
/*
|
||||
* Behaviour when detecting errors
|
||||
*/
|
||||
#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
|
||||
#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
|
||||
#define EXT2_ERRORS_PANIC 3 /* Panic */
|
||||
#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
|
||||
|
||||
/*
|
||||
* Structure of the super block
|
||||
*/
|
||||
struct ext2_super_block {
|
||||
__le32 s_inodes_count; /* Inodes count */
|
||||
__le32 s_blocks_count; /* Blocks count */
|
||||
__le32 s_r_blocks_count; /* Reserved blocks count */
|
||||
__le32 s_free_blocks_count; /* Free blocks count */
|
||||
__le32 s_free_inodes_count; /* Free inodes count */
|
||||
__le32 s_first_data_block; /* First Data Block */
|
||||
__le32 s_log_block_size; /* Block size */
|
||||
__le32 s_log_frag_size; /* Fragment size */
|
||||
__le32 s_blocks_per_group; /* # Blocks per group */
|
||||
__le32 s_frags_per_group; /* # Fragments per group */
|
||||
__le32 s_inodes_per_group; /* # Inodes per group */
|
||||
__le32 s_mtime; /* Mount time */
|
||||
__le32 s_wtime; /* Write time */
|
||||
__le16 s_mnt_count; /* Mount count */
|
||||
__le16 s_max_mnt_count; /* Maximal mount count */
|
||||
__le16 s_magic; /* Magic signature */
|
||||
__le16 s_state; /* File system state */
|
||||
__le16 s_errors; /* Behaviour when detecting errors */
|
||||
__le16 s_minor_rev_level; /* minor revision level */
|
||||
__le32 s_lastcheck; /* time of last check */
|
||||
__le32 s_checkinterval; /* max. time between checks */
|
||||
__le32 s_creator_os; /* OS */
|
||||
__le32 s_rev_level; /* Revision level */
|
||||
__le16 s_def_resuid; /* Default uid for reserved blocks */
|
||||
__le16 s_def_resgid; /* Default gid for reserved blocks */
|
||||
/*
|
||||
* These fields are for EXT2_DYNAMIC_REV superblocks only.
|
||||
*
|
||||
* Note: the difference between the compatible feature set and
|
||||
* the incompatible feature set is that if there is a bit set
|
||||
* in the incompatible feature set that the kernel doesn't
|
||||
* know about, it should refuse to mount the filesystem.
|
||||
*
|
||||
* e2fsck's requirements are more strict; if it doesn't know
|
||||
* about a feature in either the compatible or incompatible
|
||||
* feature set, it must abort and not try to meddle with
|
||||
* things it doesn't understand...
|
||||
*/
|
||||
__le32 s_first_ino; /* First non-reserved inode */
|
||||
__le16 s_inode_size; /* size of inode structure */
|
||||
__le16 s_block_group_nr; /* block group # of this superblock */
|
||||
__le32 s_feature_compat; /* compatible feature set */
|
||||
__le32 s_feature_incompat; /* incompatible feature set */
|
||||
__le32 s_feature_ro_compat; /* readonly-compatible feature set */
|
||||
__u8 s_uuid[16]; /* 128-bit uuid for volume */
|
||||
char s_volume_name[16]; /* volume name */
|
||||
char s_last_mounted[64]; /* directory where last mounted */
|
||||
__le32 s_algorithm_usage_bitmap; /* For compression */
|
||||
/*
|
||||
* Performance hints. Directory preallocation should only
|
||||
* happen if the EXT2_COMPAT_PREALLOC flag is on.
|
||||
*/
|
||||
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
|
||||
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
|
||||
__u16 s_padding1;
|
||||
/*
|
||||
* Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
|
||||
*/
|
||||
__u8 s_journal_uuid[16]; /* uuid of journal superblock */
|
||||
__u32 s_journal_inum; /* inode number of journal file */
|
||||
__u32 s_journal_dev; /* device number of journal file */
|
||||
__u32 s_last_orphan; /* start of list of inodes to delete */
|
||||
__u32 s_hash_seed[4]; /* HTREE hash seed */
|
||||
__u8 s_def_hash_version; /* Default hash version to use */
|
||||
__u8 s_reserved_char_pad;
|
||||
__u16 s_reserved_word_pad;
|
||||
__le32 s_default_mount_opts;
|
||||
__le32 s_first_meta_bg; /* First metablock block group */
|
||||
__u32 s_reserved[190]; /* Padding to the end of the block */
|
||||
};
|
||||
|
||||
/*
|
||||
* Codes for operating systems
|
||||
*/
|
||||
#define EXT2_OS_LINUX 0
|
||||
#define EXT2_OS_HURD 1
|
||||
#define EXT2_OS_MASIX 2
|
||||
#define EXT2_OS_FREEBSD 3
|
||||
#define EXT2_OS_LITES 4
|
||||
|
||||
/*
|
||||
* Revision levels
|
||||
*/
|
||||
#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
|
||||
#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
|
||||
|
||||
#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
|
||||
#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
|
||||
|
||||
#define EXT2_GOOD_OLD_INODE_SIZE 128
|
||||
|
||||
/*
|
||||
* Feature set definitions
|
||||
*/
|
||||
|
||||
#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
|
||||
( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
|
||||
#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
|
||||
( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
|
||||
#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
|
||||
( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
|
||||
#define EXT2_SET_COMPAT_FEATURE(sb,mask) \
|
||||
EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
|
||||
#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \
|
||||
EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
|
||||
#define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \
|
||||
EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
|
||||
#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \
|
||||
EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
|
||||
#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
|
||||
EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
|
||||
#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
|
||||
EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
|
||||
|
||||
#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
|
||||
#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
|
||||
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
|
||||
#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
|
||||
#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
|
||||
#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
|
||||
#define EXT2_FEATURE_COMPAT_ANY 0xffffffff
|
||||
|
||||
#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
|
||||
#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
|
||||
#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
|
||||
#define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff
|
||||
|
||||
#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
|
||||
#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
|
||||
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
|
||||
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
|
||||
#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
|
||||
#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff
|
||||
|
||||
#define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
|
||||
#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
|
||||
EXT2_FEATURE_INCOMPAT_META_BG)
|
||||
#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
|
||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
|
||||
EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
|
||||
#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP
|
||||
#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP
|
||||
|
||||
/*
|
||||
* Default values for user and/or group using reserved blocks
|
||||
*/
|
||||
#define EXT2_DEF_RESUID 0
|
||||
#define EXT2_DEF_RESGID 0
|
||||
|
||||
/*
|
||||
* Default mount options
|
||||
*/
|
||||
#define EXT2_DEFM_DEBUG 0x0001
|
||||
#define EXT2_DEFM_BSDGROUPS 0x0002
|
||||
#define EXT2_DEFM_XATTR_USER 0x0004
|
||||
#define EXT2_DEFM_ACL 0x0008
|
||||
#define EXT2_DEFM_UID16 0x0010
|
||||
/* Not used by ext2, but reserved for use by ext3 */
|
||||
#define EXT3_DEFM_JMODE 0x0060
|
||||
#define EXT3_DEFM_JMODE_DATA 0x0020
|
||||
#define EXT3_DEFM_JMODE_ORDERED 0x0040
|
||||
#define EXT3_DEFM_JMODE_WBACK 0x0060
|
||||
|
||||
/*
|
||||
* Structure of a directory entry
|
||||
*/
|
||||
#define EXT2_NAME_LEN 255
|
||||
|
||||
struct ext2_dir_entry {
|
||||
__le32 inode; /* Inode number */
|
||||
__le16 rec_len; /* Directory entry length */
|
||||
__le16 name_len; /* Name length */
|
||||
char name[EXT2_NAME_LEN]; /* File name */
|
||||
};
|
||||
|
||||
/*
|
||||
* The new version of the directory entry. Since EXT2 structures are
|
||||
* stored in intel byte order, and the name_len field could never be
|
||||
* bigger than 255 chars, it's safe to reclaim the extra byte for the
|
||||
* file_type field.
|
||||
*/
|
||||
struct ext2_dir_entry_2 {
|
||||
__le32 inode; /* Inode number */
|
||||
__le16 rec_len; /* Directory entry length */
|
||||
__u8 name_len; /* Name length */
|
||||
__u8 file_type;
|
||||
char name[EXT2_NAME_LEN]; /* File name */
|
||||
};
|
||||
|
||||
/*
|
||||
* Ext2 directory file types. Only the low 3 bits are used. The
|
||||
* other bits are reserved for now.
|
||||
*/
|
||||
enum {
|
||||
EXT2_FT_UNKNOWN = 0,
|
||||
EXT2_FT_REG_FILE = 1,
|
||||
EXT2_FT_DIR = 2,
|
||||
EXT2_FT_CHRDEV = 3,
|
||||
EXT2_FT_BLKDEV = 4,
|
||||
EXT2_FT_FIFO = 5,
|
||||
EXT2_FT_SOCK = 6,
|
||||
EXT2_FT_SYMLINK = 7,
|
||||
EXT2_FT_MAX
|
||||
};
|
||||
|
||||
/*
|
||||
* EXT2_DIR_PAD defines the directory entries boundaries
|
||||
*
|
||||
* NOTE: It must be a multiple of 4
|
||||
*/
|
||||
#define EXT2_DIR_PAD 4
|
||||
#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
|
||||
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
|
||||
~EXT2_DIR_ROUND)
|
||||
#define EXT2_MAX_REC_LEN ((1<<16)-1)
|
||||
|
||||
#endif /* _LINUX_EXT2_FS_H */
|
||||
|
|
|
|||
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
* linux/include/linux/ext2_fs_sb.h
|
||||
*
|
||||
* Copyright (C) 1992, 1993, 1994, 1995
|
||||
* Remy Card (card@masi.ibp.fr)
|
||||
* Laboratoire MASI - Institut Blaise Pascal
|
||||
* Universite Pierre et Marie Curie (Paris VI)
|
||||
*
|
||||
* from
|
||||
*
|
||||
* linux/include/linux/minix_fs_sb.h
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_EXT2_FS_SB
|
||||
#define _LINUX_EXT2_FS_SB
|
||||
|
||||
#include <linux/blockgroup_lock.h>
|
||||
#include <linux/percpu_counter.h>
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
/* XXX Here for now... not interested in restructing headers JUST now */
|
||||
|
||||
/* data type for block offset of block group */
|
||||
typedef int ext2_grpblk_t;
|
||||
|
||||
/* data type for filesystem-wide blocks number */
|
||||
typedef unsigned long ext2_fsblk_t;
|
||||
|
||||
#define E2FSBLK "%lu"
|
||||
|
||||
struct ext2_reserve_window {
|
||||
ext2_fsblk_t _rsv_start; /* First byte reserved */
|
||||
ext2_fsblk_t _rsv_end; /* Last byte reserved or 0 */
|
||||
};
|
||||
|
||||
struct ext2_reserve_window_node {
|
||||
struct rb_node rsv_node;
|
||||
__u32 rsv_goal_size;
|
||||
__u32 rsv_alloc_hit;
|
||||
struct ext2_reserve_window rsv_window;
|
||||
};
|
||||
|
||||
struct ext2_block_alloc_info {
|
||||
/* information about reservation window */
|
||||
struct ext2_reserve_window_node rsv_window_node;
|
||||
/*
|
||||
* was i_next_alloc_block in ext2_inode_info
|
||||
* is the logical (file-relative) number of the
|
||||
* most-recently-allocated block in this file.
|
||||
* We use this for detecting linearly ascending allocation requests.
|
||||
*/
|
||||
__u32 last_alloc_logical_block;
|
||||
/*
|
||||
* Was i_next_alloc_goal in ext2_inode_info
|
||||
* is the *physical* companion to i_next_alloc_block.
|
||||
* it the the physical block number of the block which was most-recentl
|
||||
* allocated to this file. This give us the goal (target) for the next
|
||||
* allocation when we detect linearly ascending requests.
|
||||
*/
|
||||
ext2_fsblk_t last_alloc_physical_block;
|
||||
};
|
||||
|
||||
#define rsv_start rsv_window._rsv_start
|
||||
#define rsv_end rsv_window._rsv_end
|
||||
|
||||
/*
|
||||
* second extended-fs super-block data in memory
|
||||
*/
|
||||
struct ext2_sb_info {
|
||||
unsigned long s_frag_size; /* Size of a fragment in bytes */
|
||||
unsigned long s_frags_per_block;/* Number of fragments per block */
|
||||
unsigned long s_inodes_per_block;/* Number of inodes per block */
|
||||
unsigned long s_frags_per_group;/* Number of fragments in a group */
|
||||
unsigned long s_blocks_per_group;/* Number of blocks in a group */
|
||||
unsigned long s_inodes_per_group;/* Number of inodes in a group */
|
||||
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 */
|
||||
unsigned long s_overhead_last; /* Last calculated overhead */
|
||||
unsigned long s_blocks_last; /* Last seen block count */
|
||||
struct buffer_head * s_sbh; /* Buffer containing the super block */
|
||||
struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
|
||||
struct buffer_head ** s_group_desc;
|
||||
unsigned long s_mount_opt;
|
||||
unsigned long s_sb_block;
|
||||
uid_t s_resuid;
|
||||
gid_t s_resgid;
|
||||
unsigned short s_mount_state;
|
||||
unsigned short s_pad;
|
||||
int s_addr_per_block_bits;
|
||||
int s_desc_per_block_bits;
|
||||
int s_inode_size;
|
||||
int s_first_ino;
|
||||
spinlock_t s_next_gen_lock;
|
||||
u32 s_next_generation;
|
||||
unsigned long s_dir_count;
|
||||
u8 *s_debts;
|
||||
struct percpu_counter s_freeblocks_counter;
|
||||
struct percpu_counter s_freeinodes_counter;
|
||||
struct percpu_counter s_dirs_counter;
|
||||
struct blockgroup_lock *s_blockgroup_lock;
|
||||
/* root of the per fs reservation window tree */
|
||||
spinlock_t s_rsv_window_lock;
|
||||
struct rb_root s_rsv_window_root;
|
||||
struct ext2_reserve_window_node s_rsv_window_head;
|
||||
/*
|
||||
* s_lock protects against concurrent modifications of s_mount_state,
|
||||
* s_blocks_last, s_overhead_last and the content of superblock's
|
||||
* buffer pointed to by sbi->s_es.
|
||||
*
|
||||
* Note: It is used in ext2_show_options() to provide a consistent view
|
||||
* of the mount options.
|
||||
*/
|
||||
spinlock_t s_lock;
|
||||
};
|
||||
|
||||
static inline spinlock_t *
|
||||
sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group)
|
||||
{
|
||||
return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_EXT2_FS_SB */
|
||||
|
|
@ -1,979 +0,0 @@
|
|||
/*
|
||||
* linux/include/linux/ext3_fs.h
|
||||
*
|
||||
* Copyright (C) 1992, 1993, 1994, 1995
|
||||
* Remy Card (card@masi.ibp.fr)
|
||||
* Laboratoire MASI - Institut Blaise Pascal
|
||||
* Universite Pierre et Marie Curie (Paris VI)
|
||||
*
|
||||
* from
|
||||
*
|
||||
* linux/include/linux/minix_fs.h
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_EXT3_FS_H
|
||||
#define _LINUX_EXT3_FS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/magic.h>
|
||||
|
||||
/*
|
||||
* The second extended filesystem constants/structures
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define EXT3FS_DEBUG to produce debug messages
|
||||
*/
|
||||
#undef EXT3FS_DEBUG
|
||||
|
||||
/*
|
||||
* Define EXT3_RESERVATION to reserve data blocks for expanding files
|
||||
*/
|
||||
#define EXT3_DEFAULT_RESERVE_BLOCKS 8
|
||||
/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
|
||||
#define EXT3_MAX_RESERVE_BLOCKS 1027
|
||||
#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
|
||||
|
||||
/*
|
||||
* Debug code
|
||||
*/
|
||||
#ifdef EXT3FS_DEBUG
|
||||
#define ext3_debug(f, a...) \
|
||||
do { \
|
||||
printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \
|
||||
__FILE__, __LINE__, __func__); \
|
||||
printk (KERN_DEBUG f, ## a); \
|
||||
} while (0)
|
||||
#else
|
||||
#define ext3_debug(f, a...) do {} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Special inodes numbers
|
||||
*/
|
||||
#define EXT3_BAD_INO 1 /* Bad blocks inode */
|
||||
#define EXT3_ROOT_INO 2 /* Root inode */
|
||||
#define EXT3_BOOT_LOADER_INO 5 /* Boot loader inode */
|
||||
#define EXT3_UNDEL_DIR_INO 6 /* Undelete directory inode */
|
||||
#define EXT3_RESIZE_INO 7 /* Reserved group descriptors inode */
|
||||
#define EXT3_JOURNAL_INO 8 /* Journal inode */
|
||||
|
||||
/* First non-reserved inode for old ext3 filesystems */
|
||||
#define EXT3_GOOD_OLD_FIRST_INO 11
|
||||
|
||||
/*
|
||||
* Maximal count of links to a file
|
||||
*/
|
||||
#define EXT3_LINK_MAX 32000
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage several block sizes
|
||||
*/
|
||||
#define EXT3_MIN_BLOCK_SIZE 1024
|
||||
#define EXT3_MAX_BLOCK_SIZE 65536
|
||||
#define EXT3_MIN_BLOCK_LOG_SIZE 10
|
||||
#ifdef __KERNEL__
|
||||
# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
|
||||
#else
|
||||
# define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
|
||||
#endif
|
||||
#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
|
||||
#ifdef __KERNEL__
|
||||
# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
|
||||
#else
|
||||
# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
|
||||
#endif
|
||||
#ifdef __KERNEL__
|
||||
#define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits)
|
||||
#define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size)
|
||||
#define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino)
|
||||
#else
|
||||
#define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
|
||||
EXT3_GOOD_OLD_INODE_SIZE : \
|
||||
(s)->s_inode_size)
|
||||
#define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
|
||||
EXT3_GOOD_OLD_FIRST_INO : \
|
||||
(s)->s_first_ino)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage fragments
|
||||
*/
|
||||
#define EXT3_MIN_FRAG_SIZE 1024
|
||||
#define EXT3_MAX_FRAG_SIZE 4096
|
||||
#define EXT3_MIN_FRAG_LOG_SIZE 10
|
||||
#ifdef __KERNEL__
|
||||
# define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size)
|
||||
# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block)
|
||||
#else
|
||||
# define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
|
||||
# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure of a blocks group descriptor
|
||||
*/
|
||||
struct ext3_group_desc
|
||||
{
|
||||
__le32 bg_block_bitmap; /* Blocks bitmap block */
|
||||
__le32 bg_inode_bitmap; /* Inodes bitmap block */
|
||||
__le32 bg_inode_table; /* Inodes table block */
|
||||
__le16 bg_free_blocks_count; /* Free blocks count */
|
||||
__le16 bg_free_inodes_count; /* Free inodes count */
|
||||
__le16 bg_used_dirs_count; /* Directories count */
|
||||
__u16 bg_pad;
|
||||
__le32 bg_reserved[3];
|
||||
};
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage group descriptors
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
# define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group)
|
||||
# define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block)
|
||||
# define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group)
|
||||
# define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits)
|
||||
#else
|
||||
# define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
|
||||
# define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
|
||||
# define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Constants relative to the data blocks
|
||||
*/
|
||||
#define EXT3_NDIR_BLOCKS 12
|
||||
#define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS
|
||||
#define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1)
|
||||
#define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1)
|
||||
#define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1)
|
||||
|
||||
/*
|
||||
* Inode flags
|
||||
*/
|
||||
#define EXT3_SECRM_FL 0x00000001 /* Secure deletion */
|
||||
#define EXT3_UNRM_FL 0x00000002 /* Undelete */
|
||||
#define EXT3_COMPR_FL 0x00000004 /* Compress file */
|
||||
#define EXT3_SYNC_FL 0x00000008 /* Synchronous updates */
|
||||
#define EXT3_IMMUTABLE_FL 0x00000010 /* Immutable file */
|
||||
#define EXT3_APPEND_FL 0x00000020 /* writes to file may only append */
|
||||
#define EXT3_NODUMP_FL 0x00000040 /* do not dump file */
|
||||
#define EXT3_NOATIME_FL 0x00000080 /* do not update atime */
|
||||
/* Reserved for compression usage... */
|
||||
#define EXT3_DIRTY_FL 0x00000100
|
||||
#define EXT3_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
|
||||
#define EXT3_NOCOMPR_FL 0x00000400 /* Don't compress */
|
||||
#define EXT3_ECOMPR_FL 0x00000800 /* Compression error */
|
||||
/* End compression flags --- maybe not all used */
|
||||
#define EXT3_INDEX_FL 0x00001000 /* hash-indexed directory */
|
||||
#define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */
|
||||
#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
|
||||
#define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
|
||||
#define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
|
||||
#define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
|
||||
#define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */
|
||||
|
||||
#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
|
||||
#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
|
||||
|
||||
/* Flags that should be inherited by new inodes from their parent. */
|
||||
#define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
|
||||
EXT3_SYNC_FL | EXT3_NODUMP_FL |\
|
||||
EXT3_NOATIME_FL | EXT3_COMPRBLK_FL |\
|
||||
EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\
|
||||
EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL)
|
||||
|
||||
/* Flags that are appropriate for regular files (all but dir-specific ones). */
|
||||
#define EXT3_REG_FLMASK (~(EXT3_DIRSYNC_FL | EXT3_TOPDIR_FL))
|
||||
|
||||
/* Flags that are appropriate for non-directories/regular files. */
|
||||
#define EXT3_OTHER_FLMASK (EXT3_NODUMP_FL | EXT3_NOATIME_FL)
|
||||
|
||||
/* Mask out flags that are inappropriate for the given type of inode. */
|
||||
static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
|
||||
{
|
||||
if (S_ISDIR(mode))
|
||||
return flags;
|
||||
else if (S_ISREG(mode))
|
||||
return flags & EXT3_REG_FLMASK;
|
||||
else
|
||||
return flags & EXT3_OTHER_FLMASK;
|
||||
}
|
||||
|
||||
/* Used to pass group descriptor data when online resize is done */
|
||||
struct ext3_new_group_input {
|
||||
__u32 group; /* Group number for this data */
|
||||
__u32 block_bitmap; /* Absolute block number of block bitmap */
|
||||
__u32 inode_bitmap; /* Absolute block number of inode bitmap */
|
||||
__u32 inode_table; /* Absolute block number of inode table start */
|
||||
__u32 blocks_count; /* Total number of blocks in this group */
|
||||
__u16 reserved_blocks; /* Number of reserved blocks in this group */
|
||||
__u16 unused;
|
||||
};
|
||||
|
||||
/* The struct ext3_new_group_input in kernel space, with free_blocks_count */
|
||||
struct ext3_new_group_data {
|
||||
__u32 group;
|
||||
__u32 block_bitmap;
|
||||
__u32 inode_bitmap;
|
||||
__u32 inode_table;
|
||||
__u32 blocks_count;
|
||||
__u16 reserved_blocks;
|
||||
__u16 unused;
|
||||
__u32 free_blocks_count;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* ioctl commands
|
||||
*/
|
||||
#define EXT3_IOC_GETFLAGS FS_IOC_GETFLAGS
|
||||
#define EXT3_IOC_SETFLAGS FS_IOC_SETFLAGS
|
||||
#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
|
||||
#define EXT3_IOC_SETVERSION _IOW('f', 4, long)
|
||||
#define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
|
||||
#define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input)
|
||||
#define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION
|
||||
#define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION
|
||||
#ifdef CONFIG_JBD_DEBUG
|
||||
#define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
|
||||
#endif
|
||||
#define EXT3_IOC_GETRSVSZ _IOR('f', 5, long)
|
||||
#define EXT3_IOC_SETRSVSZ _IOW('f', 6, long)
|
||||
|
||||
/*
|
||||
* ioctl commands in 32 bit emulation
|
||||
*/
|
||||
#define EXT3_IOC32_GETFLAGS FS_IOC32_GETFLAGS
|
||||
#define EXT3_IOC32_SETFLAGS FS_IOC32_SETFLAGS
|
||||
#define EXT3_IOC32_GETVERSION _IOR('f', 3, int)
|
||||
#define EXT3_IOC32_SETVERSION _IOW('f', 4, int)
|
||||
#define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int)
|
||||
#define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int)
|
||||
#define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
|
||||
#ifdef CONFIG_JBD_DEBUG
|
||||
#define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
|
||||
#endif
|
||||
#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
|
||||
#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
|
||||
|
||||
|
||||
/*
|
||||
* Mount options
|
||||
*/
|
||||
struct ext3_mount_options {
|
||||
unsigned long s_mount_opt;
|
||||
uid_t s_resuid;
|
||||
gid_t s_resgid;
|
||||
unsigned long s_commit_interval;
|
||||
#ifdef CONFIG_QUOTA
|
||||
int s_jquota_fmt;
|
||||
char *s_qf_names[MAXQUOTAS];
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure of an inode on the disk
|
||||
*/
|
||||
struct ext3_inode {
|
||||
__le16 i_mode; /* File mode */
|
||||
__le16 i_uid; /* Low 16 bits of Owner Uid */
|
||||
__le32 i_size; /* Size in bytes */
|
||||
__le32 i_atime; /* Access time */
|
||||
__le32 i_ctime; /* Creation 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_flags; /* File flags */
|
||||
union {
|
||||
struct {
|
||||
__u32 l_i_reserved1;
|
||||
} linux1;
|
||||
struct {
|
||||
__u32 h_i_translator;
|
||||
} hurd1;
|
||||
struct {
|
||||
__u32 m_i_reserved1;
|
||||
} masix1;
|
||||
} osd1; /* OS dependent 1 */
|
||||
__le32 i_block[EXT3_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_faddr; /* Fragment address */
|
||||
union {
|
||||
struct {
|
||||
__u8 l_i_frag; /* Fragment number */
|
||||
__u8 l_i_fsize; /* Fragment size */
|
||||
__u16 i_pad1;
|
||||
__le16 l_i_uid_high; /* these 2 fields */
|
||||
__le16 l_i_gid_high; /* were reserved2[0] */
|
||||
__u32 l_i_reserved2;
|
||||
} linux2;
|
||||
struct {
|
||||
__u8 h_i_frag; /* Fragment number */
|
||||
__u8 h_i_fsize; /* Fragment size */
|
||||
__u16 h_i_mode_high;
|
||||
__u16 h_i_uid_high;
|
||||
__u16 h_i_gid_high;
|
||||
__u32 h_i_author;
|
||||
} hurd2;
|
||||
struct {
|
||||
__u8 m_i_frag; /* Fragment number */
|
||||
__u8 m_i_fsize; /* Fragment size */
|
||||
__u16 m_pad1;
|
||||
__u32 m_i_reserved2[2];
|
||||
} masix2;
|
||||
} osd2; /* OS dependent 2 */
|
||||
__le16 i_extra_isize;
|
||||
__le16 i_pad1;
|
||||
};
|
||||
|
||||
#define i_size_high i_dir_acl
|
||||
|
||||
#if defined(__KERNEL__) || defined(__linux__)
|
||||
#define i_reserved1 osd1.linux1.l_i_reserved1
|
||||
#define i_frag osd2.linux2.l_i_frag
|
||||
#define i_fsize osd2.linux2.l_i_fsize
|
||||
#define i_uid_low i_uid
|
||||
#define i_gid_low i_gid
|
||||
#define i_uid_high osd2.linux2.l_i_uid_high
|
||||
#define i_gid_high osd2.linux2.l_i_gid_high
|
||||
#define i_reserved2 osd2.linux2.l_i_reserved2
|
||||
|
||||
#elif defined(__GNU__)
|
||||
|
||||
#define i_translator osd1.hurd1.h_i_translator
|
||||
#define i_frag osd2.hurd2.h_i_frag;
|
||||
#define i_fsize osd2.hurd2.h_i_fsize;
|
||||
#define i_uid_high osd2.hurd2.h_i_uid_high
|
||||
#define i_gid_high osd2.hurd2.h_i_gid_high
|
||||
#define i_author osd2.hurd2.h_i_author
|
||||
|
||||
#elif defined(__masix__)
|
||||
|
||||
#define i_reserved1 osd1.masix1.m_i_reserved1
|
||||
#define i_frag osd2.masix2.m_i_frag
|
||||
#define i_fsize osd2.masix2.m_i_fsize
|
||||
#define i_reserved2 osd2.masix2.m_i_reserved2
|
||||
|
||||
#endif /* defined(__KERNEL__) || defined(__linux__) */
|
||||
|
||||
/*
|
||||
* File system states
|
||||
*/
|
||||
#define EXT3_VALID_FS 0x0001 /* Unmounted cleanly */
|
||||
#define EXT3_ERROR_FS 0x0002 /* Errors detected */
|
||||
#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
|
||||
|
||||
/*
|
||||
* Misc. filesystem flags
|
||||
*/
|
||||
#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
|
||||
#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
|
||||
#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */
|
||||
|
||||
/*
|
||||
* Mount flags
|
||||
*/
|
||||
#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */
|
||||
/* EXT3_MOUNT_OLDALLOC was there */
|
||||
#define EXT3_MOUNT_GRPID 0x00004 /* Create files with directory's group */
|
||||
#define EXT3_MOUNT_DEBUG 0x00008 /* Some debugging messages */
|
||||
#define EXT3_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
|
||||
#define EXT3_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */
|
||||
#define EXT3_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
|
||||
#define EXT3_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
|
||||
#define EXT3_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
|
||||
#define EXT3_MOUNT_ABORT 0x00200 /* Fatal error detected */
|
||||
#define EXT3_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
|
||||
#define EXT3_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
|
||||
#define EXT3_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
|
||||
#define EXT3_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */
|
||||
#define EXT3_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */
|
||||
#define EXT3_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */
|
||||
#define EXT3_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */
|
||||
#define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
|
||||
#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
|
||||
#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
|
||||
#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
|
||||
#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
|
||||
#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
|
||||
#define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write
|
||||
* error in ordered mode */
|
||||
|
||||
/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
|
||||
#ifndef _LINUX_EXT2_FS_H
|
||||
#define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
|
||||
#define set_opt(o, opt) o |= EXT3_MOUNT_##opt
|
||||
#define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \
|
||||
EXT3_MOUNT_##opt)
|
||||
#else
|
||||
#define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
|
||||
#define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT
|
||||
#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
|
||||
#endif
|
||||
|
||||
#define ext3_set_bit __set_bit_le
|
||||
#define ext3_set_bit_atomic ext2_set_bit_atomic
|
||||
#define ext3_clear_bit __clear_bit_le
|
||||
#define ext3_clear_bit_atomic ext2_clear_bit_atomic
|
||||
#define ext3_test_bit test_bit_le
|
||||
#define ext3_find_next_zero_bit find_next_zero_bit_le
|
||||
|
||||
/*
|
||||
* Maximal mount counts between two filesystem checks
|
||||
*/
|
||||
#define EXT3_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
|
||||
#define EXT3_DFL_CHECKINTERVAL 0 /* Don't use interval check */
|
||||
|
||||
/*
|
||||
* Behaviour when detecting errors
|
||||
*/
|
||||
#define EXT3_ERRORS_CONTINUE 1 /* Continue execution */
|
||||
#define EXT3_ERRORS_RO 2 /* Remount fs read-only */
|
||||
#define EXT3_ERRORS_PANIC 3 /* Panic */
|
||||
#define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE
|
||||
|
||||
/*
|
||||
* Structure of the super block
|
||||
*/
|
||||
struct ext3_super_block {
|
||||
/*00*/ __le32 s_inodes_count; /* Inodes count */
|
||||
__le32 s_blocks_count; /* Blocks count */
|
||||
__le32 s_r_blocks_count; /* Reserved blocks count */
|
||||
__le32 s_free_blocks_count; /* Free blocks count */
|
||||
/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
|
||||
__le32 s_first_data_block; /* First Data Block */
|
||||
__le32 s_log_block_size; /* Block size */
|
||||
__le32 s_log_frag_size; /* Fragment size */
|
||||
/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
|
||||
__le32 s_frags_per_group; /* # Fragments per group */
|
||||
__le32 s_inodes_per_group; /* # Inodes per group */
|
||||
__le32 s_mtime; /* Mount time */
|
||||
/*30*/ __le32 s_wtime; /* Write time */
|
||||
__le16 s_mnt_count; /* Mount count */
|
||||
__le16 s_max_mnt_count; /* Maximal mount count */
|
||||
__le16 s_magic; /* Magic signature */
|
||||
__le16 s_state; /* File system state */
|
||||
__le16 s_errors; /* Behaviour when detecting errors */
|
||||
__le16 s_minor_rev_level; /* minor revision level */
|
||||
/*40*/ __le32 s_lastcheck; /* time of last check */
|
||||
__le32 s_checkinterval; /* max. time between checks */
|
||||
__le32 s_creator_os; /* OS */
|
||||
__le32 s_rev_level; /* Revision level */
|
||||
/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
|
||||
__le16 s_def_resgid; /* Default gid for reserved blocks */
|
||||
/*
|
||||
* These fields are for EXT3_DYNAMIC_REV superblocks only.
|
||||
*
|
||||
* Note: the difference between the compatible feature set and
|
||||
* the incompatible feature set is that if there is a bit set
|
||||
* in the incompatible feature set that the kernel doesn't
|
||||
* know about, it should refuse to mount the filesystem.
|
||||
*
|
||||
* e2fsck's requirements are more strict; if it doesn't know
|
||||
* about a feature in either the compatible or incompatible
|
||||
* feature set, it must abort and not try to meddle with
|
||||
* things it doesn't understand...
|
||||
*/
|
||||
__le32 s_first_ino; /* First non-reserved inode */
|
||||
__le16 s_inode_size; /* size of inode structure */
|
||||
__le16 s_block_group_nr; /* block group # of this superblock */
|
||||
__le32 s_feature_compat; /* compatible feature set */
|
||||
/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
|
||||
__le32 s_feature_ro_compat; /* readonly-compatible feature set */
|
||||
/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
|
||||
/*78*/ char s_volume_name[16]; /* volume name */
|
||||
/*88*/ char s_last_mounted[64]; /* directory where last mounted */
|
||||
/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
|
||||
/*
|
||||
* Performance hints. Directory preallocation should only
|
||||
* happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on.
|
||||
*/
|
||||
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
|
||||
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
|
||||
__le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
|
||||
/*
|
||||
* Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
|
||||
*/
|
||||
/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
|
||||
/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
|
||||
__le32 s_journal_dev; /* device number of journal file */
|
||||
__le32 s_last_orphan; /* start of list of inodes to delete */
|
||||
__le32 s_hash_seed[4]; /* HTREE hash seed */
|
||||
__u8 s_def_hash_version; /* Default hash version to use */
|
||||
__u8 s_reserved_char_pad;
|
||||
__u16 s_reserved_word_pad;
|
||||
__le32 s_default_mount_opts;
|
||||
__le32 s_first_meta_bg; /* First metablock block group */
|
||||
__le32 s_mkfs_time; /* When the filesystem was created */
|
||||
__le32 s_jnl_blocks[17]; /* Backup of the journal inode */
|
||||
/* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
|
||||
/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
|
||||
__le32 s_r_blocks_count_hi; /* Reserved blocks count */
|
||||
__le32 s_free_blocks_count_hi; /* Free blocks count */
|
||||
__le16 s_min_extra_isize; /* All inodes have at least # bytes */
|
||||
__le16 s_want_extra_isize; /* New inodes should reserve # bytes */
|
||||
__le32 s_flags; /* Miscellaneous flags */
|
||||
__le16 s_raid_stride; /* RAID stride */
|
||||
__le16 s_mmp_interval; /* # seconds to wait in MMP checking */
|
||||
__le64 s_mmp_block; /* Block for multi-mount protection */
|
||||
__le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
|
||||
__u8 s_log_groups_per_flex; /* FLEX_BG group size */
|
||||
__u8 s_reserved_char_pad2;
|
||||
__le16 s_reserved_pad;
|
||||
__u32 s_reserved[162]; /* Padding to the end of the block */
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/ext3_fs_i.h>
|
||||
#include <linux/ext3_fs_sb.h>
|
||||
static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb)
|
||||
{
|
||||
return sb->s_fs_info;
|
||||
}
|
||||
static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
|
||||
{
|
||||
return container_of(inode, struct ext3_inode_info, vfs_inode);
|
||||
}
|
||||
|
||||
static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
|
||||
{
|
||||
return ino == EXT3_ROOT_INO ||
|
||||
ino == EXT3_JOURNAL_INO ||
|
||||
ino == EXT3_RESIZE_INO ||
|
||||
(ino >= EXT3_FIRST_INO(sb) &&
|
||||
ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
|
||||
}
|
||||
|
||||
/*
|
||||
* Inode dynamic state flags
|
||||
*/
|
||||
enum {
|
||||
EXT3_STATE_JDATA, /* journaled data exists */
|
||||
EXT3_STATE_NEW, /* inode is newly created */
|
||||
EXT3_STATE_XATTR, /* has in-inode xattrs */
|
||||
EXT3_STATE_FLUSH_ON_CLOSE, /* flush dirty pages on close */
|
||||
};
|
||||
|
||||
static inline int ext3_test_inode_state(struct inode *inode, int bit)
|
||||
{
|
||||
return test_bit(bit, &EXT3_I(inode)->i_state_flags);
|
||||
}
|
||||
|
||||
static inline void ext3_set_inode_state(struct inode *inode, int bit)
|
||||
{
|
||||
set_bit(bit, &EXT3_I(inode)->i_state_flags);
|
||||
}
|
||||
|
||||
static inline void ext3_clear_inode_state(struct inode *inode, int bit)
|
||||
{
|
||||
clear_bit(bit, &EXT3_I(inode)->i_state_flags);
|
||||
}
|
||||
#else
|
||||
/* Assume that user mode programs are passing in an ext3fs superblock, not
|
||||
* a kernel struct super_block. This will allow us to call the feature-test
|
||||
* macros from user land. */
|
||||
#define EXT3_SB(sb) (sb)
|
||||
#endif
|
||||
|
||||
#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
|
||||
|
||||
/*
|
||||
* Codes for operating systems
|
||||
*/
|
||||
#define EXT3_OS_LINUX 0
|
||||
#define EXT3_OS_HURD 1
|
||||
#define EXT3_OS_MASIX 2
|
||||
#define EXT3_OS_FREEBSD 3
|
||||
#define EXT3_OS_LITES 4
|
||||
|
||||
/*
|
||||
* Revision levels
|
||||
*/
|
||||
#define EXT3_GOOD_OLD_REV 0 /* The good old (original) format */
|
||||
#define EXT3_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
|
||||
|
||||
#define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV
|
||||
#define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV
|
||||
|
||||
#define EXT3_GOOD_OLD_INODE_SIZE 128
|
||||
|
||||
/*
|
||||
* Feature set definitions
|
||||
*/
|
||||
|
||||
#define EXT3_HAS_COMPAT_FEATURE(sb,mask) \
|
||||
( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
|
||||
#define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) \
|
||||
( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
|
||||
#define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) \
|
||||
( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
|
||||
#define EXT3_SET_COMPAT_FEATURE(sb,mask) \
|
||||
EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
|
||||
#define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) \
|
||||
EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
|
||||
#define EXT3_SET_INCOMPAT_FEATURE(sb,mask) \
|
||||
EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
|
||||
#define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) \
|
||||
EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
|
||||
#define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
|
||||
EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
|
||||
#define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) \
|
||||
EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
|
||||
|
||||
#define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001
|
||||
#define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002
|
||||
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
|
||||
#define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008
|
||||
#define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010
|
||||
#define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020
|
||||
|
||||
#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
|
||||
#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
|
||||
#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
|
||||
|
||||
#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
|
||||
#define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
|
||||
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
|
||||
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
|
||||
#define EXT3_FEATURE_INCOMPAT_META_BG 0x0010
|
||||
|
||||
#define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
|
||||
#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \
|
||||
EXT3_FEATURE_INCOMPAT_RECOVER| \
|
||||
EXT3_FEATURE_INCOMPAT_META_BG)
|
||||
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
|
||||
EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
|
||||
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
|
||||
|
||||
/*
|
||||
* Default values for user and/or group using reserved blocks
|
||||
*/
|
||||
#define EXT3_DEF_RESUID 0
|
||||
#define EXT3_DEF_RESGID 0
|
||||
|
||||
/*
|
||||
* Default mount options
|
||||
*/
|
||||
#define EXT3_DEFM_DEBUG 0x0001
|
||||
#define EXT3_DEFM_BSDGROUPS 0x0002
|
||||
#define EXT3_DEFM_XATTR_USER 0x0004
|
||||
#define EXT3_DEFM_ACL 0x0008
|
||||
#define EXT3_DEFM_UID16 0x0010
|
||||
#define EXT3_DEFM_JMODE 0x0060
|
||||
#define EXT3_DEFM_JMODE_DATA 0x0020
|
||||
#define EXT3_DEFM_JMODE_ORDERED 0x0040
|
||||
#define EXT3_DEFM_JMODE_WBACK 0x0060
|
||||
|
||||
/*
|
||||
* Structure of a directory entry
|
||||
*/
|
||||
#define EXT3_NAME_LEN 255
|
||||
|
||||
struct ext3_dir_entry {
|
||||
__le32 inode; /* Inode number */
|
||||
__le16 rec_len; /* Directory entry length */
|
||||
__le16 name_len; /* Name length */
|
||||
char name[EXT3_NAME_LEN]; /* File name */
|
||||
};
|
||||
|
||||
/*
|
||||
* The new version of the directory entry. Since EXT3 structures are
|
||||
* stored in intel byte order, and the name_len field could never be
|
||||
* bigger than 255 chars, it's safe to reclaim the extra byte for the
|
||||
* file_type field.
|
||||
*/
|
||||
struct ext3_dir_entry_2 {
|
||||
__le32 inode; /* Inode number */
|
||||
__le16 rec_len; /* Directory entry length */
|
||||
__u8 name_len; /* Name length */
|
||||
__u8 file_type;
|
||||
char name[EXT3_NAME_LEN]; /* File name */
|
||||
};
|
||||
|
||||
/*
|
||||
* Ext3 directory file types. Only the low 3 bits are used. The
|
||||
* other bits are reserved for now.
|
||||
*/
|
||||
#define EXT3_FT_UNKNOWN 0
|
||||
#define EXT3_FT_REG_FILE 1
|
||||
#define EXT3_FT_DIR 2
|
||||
#define EXT3_FT_CHRDEV 3
|
||||
#define EXT3_FT_BLKDEV 4
|
||||
#define EXT3_FT_FIFO 5
|
||||
#define EXT3_FT_SOCK 6
|
||||
#define EXT3_FT_SYMLINK 7
|
||||
|
||||
#define EXT3_FT_MAX 8
|
||||
|
||||
/*
|
||||
* EXT3_DIR_PAD defines the directory entries boundaries
|
||||
*
|
||||
* NOTE: It must be a multiple of 4
|
||||
*/
|
||||
#define EXT3_DIR_PAD 4
|
||||
#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1)
|
||||
#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \
|
||||
~EXT3_DIR_ROUND)
|
||||
#define EXT3_MAX_REC_LEN ((1<<16)-1)
|
||||
|
||||
/*
|
||||
* Tests against MAX_REC_LEN etc were put in place for 64k block
|
||||
* sizes; if that is not possible on this arch, we can skip
|
||||
* those tests and speed things up.
|
||||
*/
|
||||
static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
|
||||
{
|
||||
unsigned len = le16_to_cpu(dlen);
|
||||
|
||||
#if (PAGE_CACHE_SIZE >= 65536)
|
||||
if (len == EXT3_MAX_REC_LEN)
|
||||
return 1 << 16;
|
||||
#endif
|
||||
return len;
|
||||
}
|
||||
|
||||
static inline __le16 ext3_rec_len_to_disk(unsigned len)
|
||||
{
|
||||
#if (PAGE_CACHE_SIZE >= 65536)
|
||||
if (len == (1 << 16))
|
||||
return cpu_to_le16(EXT3_MAX_REC_LEN);
|
||||
else if (len > (1 << 16))
|
||||
BUG();
|
||||
#endif
|
||||
return cpu_to_le16(len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash Tree Directory indexing
|
||||
* (c) Daniel Phillips, 2001
|
||||
*/
|
||||
|
||||
#define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
|
||||
EXT3_FEATURE_COMPAT_DIR_INDEX) && \
|
||||
(EXT3_I(dir)->i_flags & EXT3_INDEX_FL))
|
||||
#define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX)
|
||||
#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
|
||||
|
||||
/* Legal values for the dx_root hash_version field: */
|
||||
|
||||
#define DX_HASH_LEGACY 0
|
||||
#define DX_HASH_HALF_MD4 1
|
||||
#define DX_HASH_TEA 2
|
||||
#define DX_HASH_LEGACY_UNSIGNED 3
|
||||
#define DX_HASH_HALF_MD4_UNSIGNED 4
|
||||
#define DX_HASH_TEA_UNSIGNED 5
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/* hash info structure used by the directory hash */
|
||||
struct dx_hash_info
|
||||
{
|
||||
u32 hash;
|
||||
u32 minor_hash;
|
||||
int hash_version;
|
||||
u32 *seed;
|
||||
};
|
||||
|
||||
#define EXT3_HTREE_EOF 0x7fffffff
|
||||
|
||||
/*
|
||||
* Control parameters used by ext3_htree_next_block
|
||||
*/
|
||||
#define HASH_NB_ALWAYS 1
|
||||
|
||||
|
||||
/*
|
||||
* Describe an inode's exact location on disk and in memory
|
||||
*/
|
||||
struct ext3_iloc
|
||||
{
|
||||
struct buffer_head *bh;
|
||||
unsigned long offset;
|
||||
unsigned long block_group;
|
||||
};
|
||||
|
||||
static inline struct ext3_inode *ext3_raw_inode(struct ext3_iloc *iloc)
|
||||
{
|
||||
return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset);
|
||||
}
|
||||
|
||||
/*
|
||||
* This structure is stuffed into the struct file's private_data field
|
||||
* for directories. It is where we put information so that we can do
|
||||
* readdir operations in hash tree order.
|
||||
*/
|
||||
struct dir_private_info {
|
||||
struct rb_root root;
|
||||
struct rb_node *curr_node;
|
||||
struct fname *extra_fname;
|
||||
loff_t last_pos;
|
||||
__u32 curr_hash;
|
||||
__u32 curr_minor_hash;
|
||||
__u32 next_hash;
|
||||
};
|
||||
|
||||
/* calculate the first block number of the group */
|
||||
static inline ext3_fsblk_t
|
||||
ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
|
||||
{
|
||||
return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
|
||||
le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
|
||||
}
|
||||
|
||||
/*
|
||||
* Special error return code only used by dx_probe() and its callers.
|
||||
*/
|
||||
#define ERR_BAD_DX_DIR -75000
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ok, these declarations are also in <linux/kernel.h> but none of the
|
||||
* ext3 source programs needs to include it so they are duplicated here.
|
||||
*/
|
||||
# define NORET_TYPE /**/
|
||||
# define ATTRIB_NORET __attribute__((noreturn))
|
||||
# define NORET_AND noreturn,
|
||||
|
||||
/* balloc.c */
|
||||
extern int ext3_bg_has_super(struct super_block *sb, int group);
|
||||
extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
|
||||
extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode,
|
||||
ext3_fsblk_t goal, int *errp);
|
||||
extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode,
|
||||
ext3_fsblk_t goal, unsigned long *count, int *errp);
|
||||
extern void ext3_free_blocks (handle_t *handle, struct inode *inode,
|
||||
ext3_fsblk_t block, unsigned long count);
|
||||
extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
|
||||
ext3_fsblk_t block, unsigned long count,
|
||||
unsigned long *pdquot_freed_blocks);
|
||||
extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);
|
||||
extern void ext3_check_blocks_bitmap (struct super_block *);
|
||||
extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
|
||||
unsigned int block_group,
|
||||
struct buffer_head ** bh);
|
||||
extern int ext3_should_retry_alloc(struct super_block *sb, int *retries);
|
||||
extern void ext3_init_block_alloc_info(struct inode *);
|
||||
extern void ext3_rsv_window_add(struct super_block *sb, struct ext3_reserve_window_node *rsv);
|
||||
extern int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range);
|
||||
|
||||
/* dir.c */
|
||||
extern int ext3_check_dir_entry(const char *, struct inode *,
|
||||
struct ext3_dir_entry_2 *,
|
||||
struct buffer_head *, unsigned long);
|
||||
extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
|
||||
__u32 minor_hash,
|
||||
struct ext3_dir_entry_2 *dirent);
|
||||
extern void ext3_htree_free_dir_info(struct dir_private_info *p);
|
||||
|
||||
/* fsync.c */
|
||||
extern int ext3_sync_file(struct file *, loff_t, loff_t, int);
|
||||
|
||||
/* hash.c */
|
||||
extern int ext3fs_dirhash(const char *name, int len, struct
|
||||
dx_hash_info *hinfo);
|
||||
|
||||
/* ialloc.c */
|
||||
extern struct inode * ext3_new_inode (handle_t *, struct inode *,
|
||||
const struct qstr *, umode_t);
|
||||
extern void ext3_free_inode (handle_t *, struct inode *);
|
||||
extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
|
||||
extern unsigned long ext3_count_free_inodes (struct super_block *);
|
||||
extern unsigned long ext3_count_dirs (struct super_block *);
|
||||
extern void ext3_check_inodes_bitmap (struct super_block *);
|
||||
extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
|
||||
|
||||
|
||||
/* inode.c */
|
||||
int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
|
||||
struct buffer_head *bh, ext3_fsblk_t blocknr);
|
||||
struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
|
||||
struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
|
||||
int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
|
||||
sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
|
||||
int create);
|
||||
|
||||
extern struct inode *ext3_iget(struct super_block *, unsigned long);
|
||||
extern int ext3_write_inode (struct inode *, struct writeback_control *);
|
||||
extern int ext3_setattr (struct dentry *, struct iattr *);
|
||||
extern void ext3_evict_inode (struct inode *);
|
||||
extern int ext3_sync_inode (handle_t *, struct inode *);
|
||||
extern void ext3_discard_reservation (struct inode *);
|
||||
extern void ext3_dirty_inode(struct inode *, int);
|
||||
extern int ext3_change_inode_journal_flag(struct inode *, int);
|
||||
extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *);
|
||||
extern int ext3_can_truncate(struct inode *inode);
|
||||
extern void ext3_truncate(struct inode *inode);
|
||||
extern void ext3_set_inode_flags(struct inode *);
|
||||
extern void ext3_get_inode_flags(struct ext3_inode_info *);
|
||||
extern void ext3_set_aops(struct inode *inode);
|
||||
extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
||||
u64 start, u64 len);
|
||||
|
||||
/* ioctl.c */
|
||||
extern long ext3_ioctl(struct file *, unsigned int, unsigned long);
|
||||
extern long ext3_compat_ioctl(struct file *, unsigned int, unsigned long);
|
||||
|
||||
/* namei.c */
|
||||
extern int ext3_orphan_add(handle_t *, struct inode *);
|
||||
extern int ext3_orphan_del(handle_t *, struct inode *);
|
||||
extern int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
|
||||
__u32 start_minor_hash, __u32 *next_hash);
|
||||
|
||||
/* resize.c */
|
||||
extern int ext3_group_add(struct super_block *sb,
|
||||
struct ext3_new_group_data *input);
|
||||
extern int ext3_group_extend(struct super_block *sb,
|
||||
struct ext3_super_block *es,
|
||||
ext3_fsblk_t n_blocks_count);
|
||||
|
||||
/* super.c */
|
||||
extern __printf(3, 4)
|
||||
void ext3_error(struct super_block *, const char *, const char *, ...);
|
||||
extern void __ext3_std_error (struct super_block *, const char *, int);
|
||||
extern __printf(3, 4)
|
||||
void ext3_abort(struct super_block *, const char *, const char *, ...);
|
||||
extern __printf(3, 4)
|
||||
void ext3_warning(struct super_block *, const char *, const char *, ...);
|
||||
extern __printf(3, 4)
|
||||
void ext3_msg(struct super_block *, const char *, const char *, ...);
|
||||
extern void ext3_update_dynamic_rev (struct super_block *sb);
|
||||
|
||||
#define ext3_std_error(sb, errno) \
|
||||
do { \
|
||||
if ((errno)) \
|
||||
__ext3_std_error((sb), __func__, (errno)); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Inodes and files operations
|
||||
*/
|
||||
|
||||
/* dir.c */
|
||||
extern const struct file_operations ext3_dir_operations;
|
||||
|
||||
/* file.c */
|
||||
extern const struct inode_operations ext3_file_inode_operations;
|
||||
extern const struct file_operations ext3_file_operations;
|
||||
|
||||
/* namei.c */
|
||||
extern const struct inode_operations ext3_dir_inode_operations;
|
||||
extern const struct inode_operations ext3_special_inode_operations;
|
||||
|
||||
/* symlink.c */
|
||||
extern const struct inode_operations ext3_symlink_inode_operations;
|
||||
extern const struct inode_operations ext3_fast_symlink_inode_operations;
|
||||
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _LINUX_EXT3_FS_H */
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
/*
|
||||
* linux/include/linux/ext3_fs_i.h
|
||||
*
|
||||
* Copyright (C) 1992, 1993, 1994, 1995
|
||||
* Remy Card (card@masi.ibp.fr)
|
||||
* Laboratoire MASI - Institut Blaise Pascal
|
||||
* Universite Pierre et Marie Curie (Paris VI)
|
||||
*
|
||||
* from
|
||||
*
|
||||
* linux/include/linux/minix_fs_i.h
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_EXT3_FS_I
|
||||
#define _LINUX_EXT3_FS_I
|
||||
|
||||
#include <linux/rwsem.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/seqlock.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
/* data type for block offset of block group */
|
||||
typedef int ext3_grpblk_t;
|
||||
|
||||
/* data type for filesystem-wide blocks number */
|
||||
typedef unsigned long ext3_fsblk_t;
|
||||
|
||||
#define E3FSBLK "%lu"
|
||||
|
||||
struct ext3_reserve_window {
|
||||
ext3_fsblk_t _rsv_start; /* First byte reserved */
|
||||
ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */
|
||||
};
|
||||
|
||||
struct ext3_reserve_window_node {
|
||||
struct rb_node rsv_node;
|
||||
__u32 rsv_goal_size;
|
||||
__u32 rsv_alloc_hit;
|
||||
struct ext3_reserve_window rsv_window;
|
||||
};
|
||||
|
||||
struct ext3_block_alloc_info {
|
||||
/* information about reservation window */
|
||||
struct ext3_reserve_window_node rsv_window_node;
|
||||
/*
|
||||
* was i_next_alloc_block in ext3_inode_info
|
||||
* is the logical (file-relative) number of the
|
||||
* most-recently-allocated block in this file.
|
||||
* We use this for detecting linearly ascending allocation requests.
|
||||
*/
|
||||
__u32 last_alloc_logical_block;
|
||||
/*
|
||||
* Was i_next_alloc_goal in ext3_inode_info
|
||||
* is the *physical* companion to i_next_alloc_block.
|
||||
* it the physical block number of the block which was most-recentl
|
||||
* allocated to this file. This give us the goal (target) for the next
|
||||
* allocation when we detect linearly ascending requests.
|
||||
*/
|
||||
ext3_fsblk_t last_alloc_physical_block;
|
||||
};
|
||||
|
||||
#define rsv_start rsv_window._rsv_start
|
||||
#define rsv_end rsv_window._rsv_end
|
||||
|
||||
/*
|
||||
* third extended file system inode data in memory
|
||||
*/
|
||||
struct ext3_inode_info {
|
||||
__le32 i_data[15]; /* unconverted */
|
||||
__u32 i_flags;
|
||||
#ifdef EXT3_FRAGMENTS
|
||||
__u32 i_faddr;
|
||||
__u8 i_frag_no;
|
||||
__u8 i_frag_size;
|
||||
#endif
|
||||
ext3_fsblk_t i_file_acl;
|
||||
__u32 i_dir_acl;
|
||||
__u32 i_dtime;
|
||||
|
||||
/*
|
||||
* i_block_group is the number of the block group which contains
|
||||
* this file's inode. Constant across the lifetime of the inode,
|
||||
* it is ued for making block allocation decisions - we try to
|
||||
* place a file's data blocks near its inode block, and new inodes
|
||||
* near to their parent directory's inode.
|
||||
*/
|
||||
__u32 i_block_group;
|
||||
unsigned long i_state_flags; /* Dynamic state flags for ext3 */
|
||||
|
||||
/* block reservation info */
|
||||
struct ext3_block_alloc_info *i_block_alloc_info;
|
||||
|
||||
__u32 i_dir_start_lookup;
|
||||
#ifdef CONFIG_EXT3_FS_XATTR
|
||||
/*
|
||||
* Extended attributes can be read independently of the main file
|
||||
* data. Taking i_mutex even when reading would cause contention
|
||||
* between readers of EAs and writers of regular file data, so
|
||||
* instead we synchronize on xattr_sem when reading or changing
|
||||
* EAs.
|
||||
*/
|
||||
struct rw_semaphore xattr_sem;
|
||||
#endif
|
||||
|
||||
struct list_head i_orphan; /* unlinked but open inodes */
|
||||
|
||||
/*
|
||||
* i_disksize keeps track of what the inode size is ON DISK, not
|
||||
* in memory. During truncate, i_size is set to the new size by
|
||||
* the VFS prior to calling ext3_truncate(), but the filesystem won't
|
||||
* set i_disksize to 0 until the truncate is actually under way.
|
||||
*
|
||||
* The intent is that i_disksize always represents the blocks which
|
||||
* are used by this file. This allows recovery to restart truncate
|
||||
* on orphans if we crash during truncate. We actually write i_disksize
|
||||
* into the on-disk inode when writing inodes out, instead of i_size.
|
||||
*
|
||||
* The only time when i_disksize and i_size may be different is when
|
||||
* a truncate is in progress. The only things which change i_disksize
|
||||
* are ext3_get_block (growth) and ext3_truncate (shrinkth).
|
||||
*/
|
||||
loff_t i_disksize;
|
||||
|
||||
/* on-disk additional length */
|
||||
__u16 i_extra_isize;
|
||||
|
||||
/*
|
||||
* truncate_mutex is for serialising ext3_truncate() against
|
||||
* ext3_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
|
||||
* ext3 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.
|
||||
*/
|
||||
struct mutex truncate_mutex;
|
||||
|
||||
/*
|
||||
* Transactions that contain inode's metadata needed to complete
|
||||
* fsync and fdatasync, respectively.
|
||||
*/
|
||||
atomic_t i_sync_tid;
|
||||
atomic_t i_datasync_tid;
|
||||
|
||||
struct inode vfs_inode;
|
||||
};
|
||||
|
||||
#endif /* _LINUX_EXT3_FS_I */
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* linux/include/linux/ext3_fs_sb.h
|
||||
*
|
||||
* Copyright (C) 1992, 1993, 1994, 1995
|
||||
* Remy Card (card@masi.ibp.fr)
|
||||
* Laboratoire MASI - Institut Blaise Pascal
|
||||
* Universite Pierre et Marie Curie (Paris VI)
|
||||
*
|
||||
* from
|
||||
*
|
||||
* linux/include/linux/minix_fs_sb.h
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_EXT3_FS_SB
|
||||
#define _LINUX_EXT3_FS_SB
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/timer.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/blockgroup_lock.h>
|
||||
#include <linux/percpu_counter.h>
|
||||
#endif
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
/*
|
||||
* third extended-fs super-block data in memory
|
||||
*/
|
||||
struct ext3_sb_info {
|
||||
unsigned long s_frag_size; /* Size of a fragment in bytes */
|
||||
unsigned long s_frags_per_block;/* Number of fragments per block */
|
||||
unsigned long s_inodes_per_block;/* Number of inodes per block */
|
||||
unsigned long s_frags_per_group;/* Number of fragments in a group */
|
||||
unsigned long s_blocks_per_group;/* Number of blocks in a group */
|
||||
unsigned long s_inodes_per_group;/* Number of inodes in a group */
|
||||
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 */
|
||||
unsigned long s_overhead_last; /* Last calculated overhead */
|
||||
unsigned long s_blocks_last; /* Last seen block count */
|
||||
struct buffer_head * s_sbh; /* Buffer containing the super block */
|
||||
struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */
|
||||
struct buffer_head ** s_group_desc;
|
||||
unsigned long s_mount_opt;
|
||||
ext3_fsblk_t s_sb_block;
|
||||
uid_t s_resuid;
|
||||
gid_t s_resgid;
|
||||
unsigned short s_mount_state;
|
||||
unsigned short s_pad;
|
||||
int s_addr_per_block_bits;
|
||||
int s_desc_per_block_bits;
|
||||
int s_inode_size;
|
||||
int s_first_ino;
|
||||
spinlock_t s_next_gen_lock;
|
||||
u32 s_next_generation;
|
||||
u32 s_hash_seed[4];
|
||||
int s_def_hash_version;
|
||||
int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
|
||||
struct percpu_counter s_freeblocks_counter;
|
||||
struct percpu_counter s_freeinodes_counter;
|
||||
struct percpu_counter s_dirs_counter;
|
||||
struct blockgroup_lock *s_blockgroup_lock;
|
||||
|
||||
/* root of the per fs reservation window tree */
|
||||
spinlock_t s_rsv_window_lock;
|
||||
struct rb_root s_rsv_window_root;
|
||||
struct ext3_reserve_window_node s_rsv_window_head;
|
||||
|
||||
/* Journaling */
|
||||
struct inode * s_journal_inode;
|
||||
struct journal_s * s_journal;
|
||||
struct list_head s_orphan;
|
||||
struct mutex s_orphan_lock;
|
||||
struct mutex s_resize_lock;
|
||||
unsigned long s_commit_interval;
|
||||
struct block_device *journal_bdev;
|
||||
#ifdef CONFIG_QUOTA
|
||||
char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
|
||||
int s_jquota_fmt; /* Format of quota to use */
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline spinlock_t *
|
||||
sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group)
|
||||
{
|
||||
return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_EXT3_FS_SB */
|
||||
|
|
@ -1,229 +0,0 @@
|
|||
/*
|
||||
* linux/include/linux/ext3_jbd.h
|
||||
*
|
||||
* Written by Stephen C. Tweedie <sct@redhat.com>, 1999
|
||||
*
|
||||
* Copyright 1998--1999 Red Hat corp --- All Rights Reserved
|
||||
*
|
||||
* This file is part of the Linux kernel and is made available under
|
||||
* the terms of the GNU General Public License, version 2, or at your
|
||||
* option, any later version, incorporated herein by reference.
|
||||
*
|
||||
* Ext3-specific journaling extensions.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_EXT3_JBD_H
|
||||
#define _LINUX_EXT3_JBD_H
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/jbd.h>
|
||||
#include <linux/ext3_fs.h>
|
||||
|
||||
#define EXT3_JOURNAL(inode) (EXT3_SB((inode)->i_sb)->s_journal)
|
||||
|
||||
/* Define the number of blocks we need to account to a transaction to
|
||||
* modify one block of data.
|
||||
*
|
||||
* We may have to touch one inode, one bitmap buffer, up to three
|
||||
* indirection blocks, the group and superblock summaries, and the data
|
||||
* block to complete the transaction. */
|
||||
|
||||
#define EXT3_SINGLEDATA_TRANS_BLOCKS 8U
|
||||
|
||||
/* Extended attribute operations touch at most two data buffers,
|
||||
* two bitmap buffers, and two group summaries, in addition to the inode
|
||||
* and the superblock, which are already accounted for. */
|
||||
|
||||
#define EXT3_XATTR_TRANS_BLOCKS 6U
|
||||
|
||||
/* Define the minimum size for a transaction which modifies data. This
|
||||
* needs to take into account the fact that we may end up modifying two
|
||||
* quota files too (one for the group, one for the user quota). The
|
||||
* superblock only gets updated once, of course, so don't bother
|
||||
* counting that again for the quota updates. */
|
||||
|
||||
#define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \
|
||||
EXT3_XATTR_TRANS_BLOCKS - 2 + \
|
||||
EXT3_MAXQUOTAS_TRANS_BLOCKS(sb))
|
||||
|
||||
/* Delete operations potentially hit one directory's namespace plus an
|
||||
* entire inode, plus arbitrary amounts of bitmap/indirection data. Be
|
||||
* generous. We can grow the delete transaction later if necessary. */
|
||||
|
||||
#define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64)
|
||||
|
||||
/* Define an arbitrary limit for the amount of data we will anticipate
|
||||
* writing to any given transaction. For unbounded transactions such as
|
||||
* write(2) and truncate(2) we can write more than this, but we always
|
||||
* start off at the maximum transaction size and grow the transaction
|
||||
* optimistically as we go. */
|
||||
|
||||
#define EXT3_MAX_TRANS_DATA 64U
|
||||
|
||||
/* We break up a large truncate or write transaction once the handle's
|
||||
* buffer credits gets this low, we need either to extend the
|
||||
* transaction or to start a new one. Reserve enough space here for
|
||||
* inode, bitmap, superblock, group and indirection updates for at least
|
||||
* one block, plus two quota updates. Quota allocations are not
|
||||
* needed. */
|
||||
|
||||
#define EXT3_RESERVE_TRANS_BLOCKS 12U
|
||||
|
||||
#define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8
|
||||
|
||||
#ifdef CONFIG_QUOTA
|
||||
/* Amount of blocks needed for quota update - we know that the structure was
|
||||
* allocated so we need to update only inode+data */
|
||||
#define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0)
|
||||
/* Amount of blocks needed for quota insert/delete - we do some block writes
|
||||
* but inode, sb and group updates are done only once */
|
||||
#define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
|
||||
(EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0)
|
||||
#define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
|
||||
(EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0)
|
||||
#else
|
||||
#define EXT3_QUOTA_TRANS_BLOCKS(sb) 0
|
||||
#define EXT3_QUOTA_INIT_BLOCKS(sb) 0
|
||||
#define EXT3_QUOTA_DEL_BLOCKS(sb) 0
|
||||
#endif
|
||||
#define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb))
|
||||
#define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb))
|
||||
#define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb))
|
||||
|
||||
int
|
||||
ext3_mark_iloc_dirty(handle_t *handle,
|
||||
struct inode *inode,
|
||||
struct ext3_iloc *iloc);
|
||||
|
||||
/*
|
||||
* On success, We end up with an outstanding reference count against
|
||||
* iloc->bh. This _must_ be cleaned up later.
|
||||
*/
|
||||
|
||||
int ext3_reserve_inode_write(handle_t *handle, struct inode *inode,
|
||||
struct ext3_iloc *iloc);
|
||||
|
||||
int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode);
|
||||
|
||||
/*
|
||||
* Wrapper functions with which ext3 calls into JBD. The intent here is
|
||||
* to allow these to be turned into appropriate stubs so ext3 can control
|
||||
* ext2 filesystems, so ext2+ext3 systems only nee one fs. This work hasn't
|
||||
* been done yet.
|
||||
*/
|
||||
|
||||
static inline void ext3_journal_release_buffer(handle_t *handle,
|
||||
struct buffer_head *bh)
|
||||
{
|
||||
journal_release_buffer(handle, bh);
|
||||
}
|
||||
|
||||
void ext3_journal_abort_handle(const char *caller, const char *err_fn,
|
||||
struct buffer_head *bh, handle_t *handle, int err);
|
||||
|
||||
int __ext3_journal_get_undo_access(const char *where, handle_t *handle,
|
||||
struct buffer_head *bh);
|
||||
|
||||
int __ext3_journal_get_write_access(const char *where, handle_t *handle,
|
||||
struct buffer_head *bh);
|
||||
|
||||
int __ext3_journal_forget(const char *where, handle_t *handle,
|
||||
struct buffer_head *bh);
|
||||
|
||||
int __ext3_journal_revoke(const char *where, handle_t *handle,
|
||||
unsigned long blocknr, struct buffer_head *bh);
|
||||
|
||||
int __ext3_journal_get_create_access(const char *where,
|
||||
handle_t *handle, struct buffer_head *bh);
|
||||
|
||||
int __ext3_journal_dirty_metadata(const char *where,
|
||||
handle_t *handle, struct buffer_head *bh);
|
||||
|
||||
#define ext3_journal_get_undo_access(handle, bh) \
|
||||
__ext3_journal_get_undo_access(__func__, (handle), (bh))
|
||||
#define ext3_journal_get_write_access(handle, bh) \
|
||||
__ext3_journal_get_write_access(__func__, (handle), (bh))
|
||||
#define ext3_journal_revoke(handle, blocknr, bh) \
|
||||
__ext3_journal_revoke(__func__, (handle), (blocknr), (bh))
|
||||
#define ext3_journal_get_create_access(handle, bh) \
|
||||
__ext3_journal_get_create_access(__func__, (handle), (bh))
|
||||
#define ext3_journal_dirty_metadata(handle, bh) \
|
||||
__ext3_journal_dirty_metadata(__func__, (handle), (bh))
|
||||
#define ext3_journal_forget(handle, bh) \
|
||||
__ext3_journal_forget(__func__, (handle), (bh))
|
||||
|
||||
int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh);
|
||||
|
||||
handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks);
|
||||
int __ext3_journal_stop(const char *where, handle_t *handle);
|
||||
|
||||
static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks)
|
||||
{
|
||||
return ext3_journal_start_sb(inode->i_sb, nblocks);
|
||||
}
|
||||
|
||||
#define ext3_journal_stop(handle) \
|
||||
__ext3_journal_stop(__func__, (handle))
|
||||
|
||||
static inline handle_t *ext3_journal_current_handle(void)
|
||||
{
|
||||
return journal_current_handle();
|
||||
}
|
||||
|
||||
static inline int ext3_journal_extend(handle_t *handle, int nblocks)
|
||||
{
|
||||
return journal_extend(handle, nblocks);
|
||||
}
|
||||
|
||||
static inline int ext3_journal_restart(handle_t *handle, int nblocks)
|
||||
{
|
||||
return journal_restart(handle, nblocks);
|
||||
}
|
||||
|
||||
static inline int ext3_journal_blocks_per_page(struct inode *inode)
|
||||
{
|
||||
return journal_blocks_per_page(inode);
|
||||
}
|
||||
|
||||
static inline int ext3_journal_force_commit(journal_t *journal)
|
||||
{
|
||||
return journal_force_commit(journal);
|
||||
}
|
||||
|
||||
/* super.c */
|
||||
int ext3_force_commit(struct super_block *sb);
|
||||
|
||||
static inline int ext3_should_journal_data(struct inode *inode)
|
||||
{
|
||||
if (!S_ISREG(inode->i_mode))
|
||||
return 1;
|
||||
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
|
||||
return 1;
|
||||
if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ext3_should_order_data(struct inode *inode)
|
||||
{
|
||||
if (!S_ISREG(inode->i_mode))
|
||||
return 0;
|
||||
if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
|
||||
return 0;
|
||||
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ext3_should_writeback_data(struct inode *inode)
|
||||
{
|
||||
if (!S_ISREG(inode->i_mode))
|
||||
return 0;
|
||||
if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
|
||||
return 0;
|
||||
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_EXT3_JBD_H */
|
||||
|
|
@ -407,7 +407,6 @@ struct fb_cursor {
|
|||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/list.h>
|
||||
|
|
|
|||
|
|
@ -21,23 +21,45 @@
|
|||
*/
|
||||
#define NR_OPEN_DEFAULT BITS_PER_LONG
|
||||
|
||||
/*
|
||||
* The embedded_fd_set is a small fd_set,
|
||||
* suitable for most tasks (which open <= BITS_PER_LONG files)
|
||||
*/
|
||||
struct embedded_fd_set {
|
||||
unsigned long fds_bits[1];
|
||||
};
|
||||
|
||||
struct fdtable {
|
||||
unsigned int max_fds;
|
||||
struct file __rcu **fd; /* current fd array */
|
||||
fd_set *close_on_exec;
|
||||
fd_set *open_fds;
|
||||
unsigned long *close_on_exec;
|
||||
unsigned long *open_fds;
|
||||
struct rcu_head rcu;
|
||||
struct fdtable *next;
|
||||
};
|
||||
|
||||
static inline void __set_close_on_exec(int fd, struct fdtable *fdt)
|
||||
{
|
||||
__set_bit(fd, fdt->close_on_exec);
|
||||
}
|
||||
|
||||
static inline void __clear_close_on_exec(int fd, struct fdtable *fdt)
|
||||
{
|
||||
__clear_bit(fd, fdt->close_on_exec);
|
||||
}
|
||||
|
||||
static inline bool close_on_exec(int fd, const struct fdtable *fdt)
|
||||
{
|
||||
return test_bit(fd, fdt->close_on_exec);
|
||||
}
|
||||
|
||||
static inline void __set_open_fd(int fd, struct fdtable *fdt)
|
||||
{
|
||||
__set_bit(fd, fdt->open_fds);
|
||||
}
|
||||
|
||||
static inline void __clear_open_fd(int fd, struct fdtable *fdt)
|
||||
{
|
||||
__clear_bit(fd, fdt->open_fds);
|
||||
}
|
||||
|
||||
static inline bool fd_is_open(int fd, const struct fdtable *fdt)
|
||||
{
|
||||
return test_bit(fd, fdt->open_fds);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open file table structure
|
||||
*/
|
||||
|
|
@ -53,8 +75,8 @@ struct files_struct {
|
|||
*/
|
||||
spinlock_t file_lock ____cacheline_aligned_in_smp;
|
||||
int next_fd;
|
||||
struct embedded_fd_set close_on_exec_init;
|
||||
struct embedded_fd_set open_fds_init;
|
||||
unsigned long close_on_exec_init[1];
|
||||
unsigned long open_fds_init[1];
|
||||
struct file __rcu * fd_array[NR_OPEN_DEFAULT];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,10 @@ struct inodes_stat_t {
|
|||
/* File is opened using open(.., 3, ..) and is writeable only for ioctls
|
||||
(specialy hack for floppy.c) */
|
||||
#define FMODE_WRITE_IOCTL ((__force fmode_t)0x100)
|
||||
/* 32bit hashes as llseek() offset (for directories) */
|
||||
#define FMODE_32BITHASH ((__force fmode_t)0x200)
|
||||
/* 64bit hashes as llseek() offset (for directories) */
|
||||
#define FMODE_64BITHASH ((__force fmode_t)0x400)
|
||||
|
||||
/*
|
||||
* Don't update ctime and mtime.
|
||||
|
|
@ -389,6 +393,7 @@ struct inodes_stat_t {
|
|||
#include <linux/prio_tree.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/pid.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/semaphore.h>
|
||||
|
|
@ -1210,6 +1215,7 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
|
|||
extern int lease_modify(struct file_lock **, int);
|
||||
extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
|
||||
extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
|
||||
extern void locks_delete_block(struct file_lock *waiter);
|
||||
extern void lock_flocks(void);
|
||||
extern void unlock_flocks(void);
|
||||
#else /* !CONFIG_FILE_LOCKING */
|
||||
|
|
@ -1354,6 +1360,10 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static inline void locks_delete_block(struct file_lock *waiter)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void lock_flocks(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -1871,19 +1881,6 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
|
|||
const struct dentry_operations *dops,
|
||||
unsigned long);
|
||||
|
||||
static inline void sb_mark_dirty(struct super_block *sb)
|
||||
{
|
||||
sb->s_dirt = 1;
|
||||
}
|
||||
static inline void sb_mark_clean(struct super_block *sb)
|
||||
{
|
||||
sb->s_dirt = 0;
|
||||
}
|
||||
static inline int sb_is_dirty(struct super_block *sb)
|
||||
{
|
||||
return sb->s_dirt;
|
||||
}
|
||||
|
||||
/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
|
||||
#define fops_get(fops) \
|
||||
(((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
|
||||
|
|
@ -2514,6 +2511,7 @@ extern int dcache_readdir(struct file *, void *, filldir_t);
|
|||
extern int simple_setattr(struct dentry *, struct iattr *);
|
||||
extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
|
||||
extern int simple_statfs(struct dentry *, struct kstatfs *);
|
||||
extern int simple_open(struct inode *inode, struct file *file);
|
||||
extern int simple_link(struct dentry *, struct inode *, struct dentry *);
|
||||
extern int simple_unlink(struct inode *, struct dentry *);
|
||||
extern int simple_rmdir(struct inode *, struct dentry *);
|
||||
|
|
|
|||
28
include/linux/fsl/mxs-dma.h
Normal file
28
include/linux/fsl/mxs-dma.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __MACH_MXS_DMA_H__
|
||||
#define __MACH_MXS_DMA_H__
|
||||
|
||||
#include <linux/dmaengine.h>
|
||||
|
||||
struct mxs_dma_data {
|
||||
int chan_irq;
|
||||
};
|
||||
|
||||
static inline int mxs_dma_is_apbh(struct dma_chan *chan)
|
||||
{
|
||||
return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
|
||||
}
|
||||
|
||||
static inline int mxs_dma_is_apbx(struct dma_chan *chan)
|
||||
{
|
||||
return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
|
||||
}
|
||||
|
||||
#endif /* __MACH_MXS_DMA_H__ */
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
#include <linux/fsnotify_backend.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
/*
|
||||
* fsnotify_d_instantiate - instantiate a dentry for inode
|
||||
|
|
|
|||
|
|
@ -144,12 +144,14 @@ struct event_filter;
|
|||
enum trace_reg {
|
||||
TRACE_REG_REGISTER,
|
||||
TRACE_REG_UNREGISTER,
|
||||
#ifdef CONFIG_PERF_EVENTS
|
||||
TRACE_REG_PERF_REGISTER,
|
||||
TRACE_REG_PERF_UNREGISTER,
|
||||
TRACE_REG_PERF_OPEN,
|
||||
TRACE_REG_PERF_CLOSE,
|
||||
TRACE_REG_PERF_ADD,
|
||||
TRACE_REG_PERF_DEL,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ftrace_event_call;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,12 @@
|
|||
#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
|
||||
#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
|
||||
|
||||
/* Gpio pin is open drain */
|
||||
#define GPIOF_OPEN_DRAIN (1 << 2)
|
||||
|
||||
/* Gpio pin is open source */
|
||||
#define GPIOF_OPEN_SOURCE (1 << 3)
|
||||
|
||||
/**
|
||||
* struct gpio - a structure describing a GPIO with configuration
|
||||
* @gpio: the GPIO number
|
||||
|
|
@ -34,6 +40,7 @@ struct gpio {
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
struct device;
|
||||
struct gpio_chip;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ struct device;
|
|||
struct gpio_keys_button {
|
||||
/* Configuration parameters */
|
||||
unsigned int code; /* input event code (KEY_*, SW_*) */
|
||||
int gpio;
|
||||
int gpio; /* -1 if this key does not support gpio */
|
||||
int active_low;
|
||||
const char *desc;
|
||||
unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */
|
||||
|
|
@ -14,6 +14,7 @@ struct gpio_keys_button {
|
|||
int debounce_interval; /* debounce ticks interval in msecs */
|
||||
bool can_disable;
|
||||
int value; /* axis value for EV_ABS */
|
||||
unsigned int irq; /* Irq number in case of interrupt keys */
|
||||
};
|
||||
|
||||
struct gpio_keys_platform_data {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/hardirq.h>
|
||||
|
|
|
|||
1
include/linux/hsi/Kbuild
Normal file
1
include/linux/hsi/Kbuild
Normal file
|
|
@ -0,0 +1 @@
|
|||
header-y += hsi_char.h
|
||||
410
include/linux/hsi/hsi.h
Normal file
410
include/linux/hsi/hsi.h
Normal file
|
|
@ -0,0 +1,410 @@
|
|||
/*
|
||||
* HSI core header file.
|
||||
*
|
||||
* Copyright (C) 2010 Nokia Corporation. All rights reserved.
|
||||
*
|
||||
* Contact: Carlos Chinea <carlos.chinea@nokia.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_HSI_H__
|
||||
#define __LINUX_HSI_H__
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
/* HSI message ttype */
|
||||
#define HSI_MSG_READ 0
|
||||
#define HSI_MSG_WRITE 1
|
||||
|
||||
/* HSI configuration values */
|
||||
enum {
|
||||
HSI_MODE_STREAM = 1,
|
||||
HSI_MODE_FRAME,
|
||||
};
|
||||
|
||||
enum {
|
||||
HSI_FLOW_SYNC, /* Synchronized flow */
|
||||
HSI_FLOW_PIPE, /* Pipelined flow */
|
||||
};
|
||||
|
||||
enum {
|
||||
HSI_ARB_RR, /* Round-robin arbitration */
|
||||
HSI_ARB_PRIO, /* Channel priority arbitration */
|
||||
};
|
||||
|
||||
#define HSI_MAX_CHANNELS 16
|
||||
|
||||
/* HSI message status codes */
|
||||
enum {
|
||||
HSI_STATUS_COMPLETED, /* Message transfer is completed */
|
||||
HSI_STATUS_PENDING, /* Message pending to be read/write (POLL) */
|
||||
HSI_STATUS_PROCEEDING, /* Message transfer is ongoing */
|
||||
HSI_STATUS_QUEUED, /* Message waiting to be served */
|
||||
HSI_STATUS_ERROR, /* Error when message transfer was ongoing */
|
||||
};
|
||||
|
||||
/* HSI port event codes */
|
||||
enum {
|
||||
HSI_EVENT_START_RX,
|
||||
HSI_EVENT_STOP_RX,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hsi_config - Configuration for RX/TX HSI modules
|
||||
* @mode: Bit transmission mode (STREAM or FRAME)
|
||||
* @channels: Number of channels to use [1..16]
|
||||
* @speed: Max bit transmission speed (Kbit/s)
|
||||
* @flow: RX flow type (SYNCHRONIZED or PIPELINE)
|
||||
* @arb_mode: Arbitration mode for TX frame (Round robin, priority)
|
||||
*/
|
||||
struct hsi_config {
|
||||
unsigned int mode;
|
||||
unsigned int channels;
|
||||
unsigned int speed;
|
||||
union {
|
||||
unsigned int flow; /* RX only */
|
||||
unsigned int arb_mode; /* TX only */
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hsi_board_info - HSI client board info
|
||||
* @name: Name for the HSI device
|
||||
* @hsi_id: HSI controller id where the client sits
|
||||
* @port: Port number in the controller where the client sits
|
||||
* @tx_cfg: HSI TX configuration
|
||||
* @rx_cfg: HSI RX configuration
|
||||
* @platform_data: Platform related data
|
||||
* @archdata: Architecture-dependent device data
|
||||
*/
|
||||
struct hsi_board_info {
|
||||
const char *name;
|
||||
unsigned int hsi_id;
|
||||
unsigned int port;
|
||||
struct hsi_config tx_cfg;
|
||||
struct hsi_config rx_cfg;
|
||||
void *platform_data;
|
||||
struct dev_archdata *archdata;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_HSI_BOARDINFO
|
||||
extern int hsi_register_board_info(struct hsi_board_info const *info,
|
||||
unsigned int len);
|
||||
#else
|
||||
static inline int hsi_register_board_info(struct hsi_board_info const *info,
|
||||
unsigned int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_HSI_BOARDINFO */
|
||||
|
||||
/**
|
||||
* struct hsi_client - HSI client attached to an HSI port
|
||||
* @device: Driver model representation of the device
|
||||
* @tx_cfg: HSI TX configuration
|
||||
* @rx_cfg: HSI RX configuration
|
||||
* @hsi_start_rx: Called after incoming wake line goes high
|
||||
* @hsi_stop_rx: Called after incoming wake line goes low
|
||||
*/
|
||||
struct hsi_client {
|
||||
struct device device;
|
||||
struct hsi_config tx_cfg;
|
||||
struct hsi_config rx_cfg;
|
||||
void (*hsi_start_rx)(struct hsi_client *cl);
|
||||
void (*hsi_stop_rx)(struct hsi_client *cl);
|
||||
/* private: */
|
||||
unsigned int pclaimed:1;
|
||||
struct list_head link;
|
||||
};
|
||||
|
||||
#define to_hsi_client(dev) container_of(dev, struct hsi_client, device)
|
||||
|
||||
static inline void hsi_client_set_drvdata(struct hsi_client *cl, void *data)
|
||||
{
|
||||
dev_set_drvdata(&cl->device, data);
|
||||
}
|
||||
|
||||
static inline void *hsi_client_drvdata(struct hsi_client *cl)
|
||||
{
|
||||
return dev_get_drvdata(&cl->device);
|
||||
}
|
||||
|
||||
/**
|
||||
* struct hsi_client_driver - Driver associated to an HSI client
|
||||
* @driver: Driver model representation of the driver
|
||||
*/
|
||||
struct hsi_client_driver {
|
||||
struct device_driver driver;
|
||||
};
|
||||
|
||||
#define to_hsi_client_driver(drv) container_of(drv, struct hsi_client_driver,\
|
||||
driver)
|
||||
|
||||
int hsi_register_client_driver(struct hsi_client_driver *drv);
|
||||
|
||||
static inline void hsi_unregister_client_driver(struct hsi_client_driver *drv)
|
||||
{
|
||||
driver_unregister(&drv->driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* struct hsi_msg - HSI message descriptor
|
||||
* @link: Free to use by the current descriptor owner
|
||||
* @cl: HSI device client that issues the transfer
|
||||
* @sgt: Head of the scatterlist array
|
||||
* @context: Client context data associated to the transfer
|
||||
* @complete: Transfer completion callback
|
||||
* @destructor: Destructor to free resources when flushing
|
||||
* @status: Status of the transfer when completed
|
||||
* @actual_len: Actual length of data transfered on completion
|
||||
* @channel: Channel were to TX/RX the message
|
||||
* @ttype: Transfer type (TX if set, RX otherwise)
|
||||
* @break_frame: if true HSI will send/receive a break frame. Data buffers are
|
||||
* ignored in the request.
|
||||
*/
|
||||
struct hsi_msg {
|
||||
struct list_head link;
|
||||
struct hsi_client *cl;
|
||||
struct sg_table sgt;
|
||||
void *context;
|
||||
|
||||
void (*complete)(struct hsi_msg *msg);
|
||||
void (*destructor)(struct hsi_msg *msg);
|
||||
|
||||
int status;
|
||||
unsigned int actual_len;
|
||||
unsigned int channel;
|
||||
unsigned int ttype:1;
|
||||
unsigned int break_frame:1;
|
||||
};
|
||||
|
||||
struct hsi_msg *hsi_alloc_msg(unsigned int n_frag, gfp_t flags);
|
||||
void hsi_free_msg(struct hsi_msg *msg);
|
||||
|
||||
/**
|
||||
* struct hsi_port - HSI port device
|
||||
* @device: Driver model representation of the device
|
||||
* @tx_cfg: Current TX path configuration
|
||||
* @rx_cfg: Current RX path configuration
|
||||
* @num: Port number
|
||||
* @shared: Set when port can be shared by different clients
|
||||
* @claimed: Reference count of clients which claimed the port
|
||||
* @lock: Serialize port claim
|
||||
* @async: Asynchronous transfer callback
|
||||
* @setup: Callback to set the HSI client configuration
|
||||
* @flush: Callback to clean the HW state and destroy all pending transfers
|
||||
* @start_tx: Callback to inform that a client wants to TX data
|
||||
* @stop_tx: Callback to inform that a client no longer wishes to TX data
|
||||
* @release: Callback to inform that a client no longer uses the port
|
||||
* @clients: List of hsi_clients using the port.
|
||||
* @clock: Lock to serialize access to the clients list.
|
||||
*/
|
||||
struct hsi_port {
|
||||
struct device device;
|
||||
struct hsi_config tx_cfg;
|
||||
struct hsi_config rx_cfg;
|
||||
unsigned int num;
|
||||
unsigned int shared:1;
|
||||
int claimed;
|
||||
struct mutex lock;
|
||||
int (*async)(struct hsi_msg *msg);
|
||||
int (*setup)(struct hsi_client *cl);
|
||||
int (*flush)(struct hsi_client *cl);
|
||||
int (*start_tx)(struct hsi_client *cl);
|
||||
int (*stop_tx)(struct hsi_client *cl);
|
||||
int (*release)(struct hsi_client *cl);
|
||||
struct list_head clients;
|
||||
spinlock_t clock;
|
||||
};
|
||||
|
||||
#define to_hsi_port(dev) container_of(dev, struct hsi_port, device)
|
||||
#define hsi_get_port(cl) to_hsi_port((cl)->device.parent)
|
||||
|
||||
void hsi_event(struct hsi_port *port, unsigned int event);
|
||||
int hsi_claim_port(struct hsi_client *cl, unsigned int share);
|
||||
void hsi_release_port(struct hsi_client *cl);
|
||||
|
||||
static inline int hsi_port_claimed(struct hsi_client *cl)
|
||||
{
|
||||
return cl->pclaimed;
|
||||
}
|
||||
|
||||
static inline void hsi_port_set_drvdata(struct hsi_port *port, void *data)
|
||||
{
|
||||
dev_set_drvdata(&port->device, data);
|
||||
}
|
||||
|
||||
static inline void *hsi_port_drvdata(struct hsi_port *port)
|
||||
{
|
||||
return dev_get_drvdata(&port->device);
|
||||
}
|
||||
|
||||
/**
|
||||
* struct hsi_controller - HSI controller device
|
||||
* @device: Driver model representation of the device
|
||||
* @owner: Pointer to the module owning the controller
|
||||
* @id: HSI controller ID
|
||||
* @num_ports: Number of ports in the HSI controller
|
||||
* @port: Array of HSI ports
|
||||
*/
|
||||
struct hsi_controller {
|
||||
struct device device;
|
||||
struct module *owner;
|
||||
unsigned int id;
|
||||
unsigned int num_ports;
|
||||
struct hsi_port *port;
|
||||
};
|
||||
|
||||
#define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device)
|
||||
|
||||
struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
|
||||
void hsi_free_controller(struct hsi_controller *hsi);
|
||||
int hsi_register_controller(struct hsi_controller *hsi);
|
||||
void hsi_unregister_controller(struct hsi_controller *hsi);
|
||||
|
||||
static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,
|
||||
void *data)
|
||||
{
|
||||
dev_set_drvdata(&hsi->device, data);
|
||||
}
|
||||
|
||||
static inline void *hsi_controller_drvdata(struct hsi_controller *hsi)
|
||||
{
|
||||
return dev_get_drvdata(&hsi->device);
|
||||
}
|
||||
|
||||
static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi,
|
||||
unsigned int num)
|
||||
{
|
||||
return (num < hsi->num_ports) ? &hsi->port[num] : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* API for HSI clients
|
||||
*/
|
||||
int hsi_async(struct hsi_client *cl, struct hsi_msg *msg);
|
||||
|
||||
/**
|
||||
* hsi_id - Get HSI controller ID associated to a client
|
||||
* @cl: Pointer to a HSI client
|
||||
*
|
||||
* Return the controller id where the client is attached to
|
||||
*/
|
||||
static inline unsigned int hsi_id(struct hsi_client *cl)
|
||||
{
|
||||
return to_hsi_controller(cl->device.parent->parent)->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* hsi_port_id - Gets the port number a client is attached to
|
||||
* @cl: Pointer to HSI client
|
||||
*
|
||||
* Return the port number associated to the client
|
||||
*/
|
||||
static inline unsigned int hsi_port_id(struct hsi_client *cl)
|
||||
{
|
||||
return to_hsi_port(cl->device.parent)->num;
|
||||
}
|
||||
|
||||
/**
|
||||
* hsi_setup - Configure the client's port
|
||||
* @cl: Pointer to the HSI client
|
||||
*
|
||||
* When sharing ports, clients should either relay on a single
|
||||
* client setup or have the same setup for all of them.
|
||||
*
|
||||
* Return -errno on failure, 0 on success
|
||||
*/
|
||||
static inline int hsi_setup(struct hsi_client *cl)
|
||||
{
|
||||
if (!hsi_port_claimed(cl))
|
||||
return -EACCES;
|
||||
return hsi_get_port(cl)->setup(cl);
|
||||
}
|
||||
|
||||
/**
|
||||
* hsi_flush - Flush all pending transactions on the client's port
|
||||
* @cl: Pointer to the HSI client
|
||||
*
|
||||
* This function will destroy all pending hsi_msg in the port and reset
|
||||
* the HW port so it is ready to receive and transmit from a clean state.
|
||||
*
|
||||
* Return -errno on failure, 0 on success
|
||||
*/
|
||||
static inline int hsi_flush(struct hsi_client *cl)
|
||||
{
|
||||
if (!hsi_port_claimed(cl))
|
||||
return -EACCES;
|
||||
return hsi_get_port(cl)->flush(cl);
|
||||
}
|
||||
|
||||
/**
|
||||
* hsi_async_read - Submit a read transfer
|
||||
* @cl: Pointer to the HSI client
|
||||
* @msg: HSI message descriptor of the transfer
|
||||
*
|
||||
* Return -errno on failure, 0 on success
|
||||
*/
|
||||
static inline int hsi_async_read(struct hsi_client *cl, struct hsi_msg *msg)
|
||||
{
|
||||
msg->ttype = HSI_MSG_READ;
|
||||
return hsi_async(cl, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* hsi_async_write - Submit a write transfer
|
||||
* @cl: Pointer to the HSI client
|
||||
* @msg: HSI message descriptor of the transfer
|
||||
*
|
||||
* Return -errno on failure, 0 on success
|
||||
*/
|
||||
static inline int hsi_async_write(struct hsi_client *cl, struct hsi_msg *msg)
|
||||
{
|
||||
msg->ttype = HSI_MSG_WRITE;
|
||||
return hsi_async(cl, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* hsi_start_tx - Signal the port that the client wants to start a TX
|
||||
* @cl: Pointer to the HSI client
|
||||
*
|
||||
* Return -errno on failure, 0 on success
|
||||
*/
|
||||
static inline int hsi_start_tx(struct hsi_client *cl)
|
||||
{
|
||||
if (!hsi_port_claimed(cl))
|
||||
return -EACCES;
|
||||
return hsi_get_port(cl)->start_tx(cl);
|
||||
}
|
||||
|
||||
/**
|
||||
* hsi_stop_tx - Signal the port that the client no longer wants to transmit
|
||||
* @cl: Pointer to the HSI client
|
||||
*
|
||||
* Return -errno on failure, 0 on success
|
||||
*/
|
||||
static inline int hsi_stop_tx(struct hsi_client *cl)
|
||||
{
|
||||
if (!hsi_port_claimed(cl))
|
||||
return -EACCES;
|
||||
return hsi_get_port(cl)->stop_tx(cl);
|
||||
}
|
||||
#endif /* __LINUX_HSI_H__ */
|
||||
63
include/linux/hsi/hsi_char.h
Normal file
63
include/linux/hsi/hsi_char.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Part of the HSI character device driver.
|
||||
*
|
||||
* Copyright (C) 2010 Nokia Corporation. All rights reserved.
|
||||
*
|
||||
* Contact: Andras Domokos <andras.domokos at nokia.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __HSI_CHAR_H
|
||||
#define __HSI_CHAR_H
|
||||
|
||||
#define HSI_CHAR_MAGIC 'k'
|
||||
#define HSC_IOW(num, dtype) _IOW(HSI_CHAR_MAGIC, num, dtype)
|
||||
#define HSC_IOR(num, dtype) _IOR(HSI_CHAR_MAGIC, num, dtype)
|
||||
#define HSC_IOWR(num, dtype) _IOWR(HSI_CHAR_MAGIC, num, dtype)
|
||||
#define HSC_IO(num) _IO(HSI_CHAR_MAGIC, num)
|
||||
|
||||
#define HSC_RESET HSC_IO(16)
|
||||
#define HSC_SET_PM HSC_IO(17)
|
||||
#define HSC_SEND_BREAK HSC_IO(18)
|
||||
#define HSC_SET_RX HSC_IOW(19, struct hsc_rx_config)
|
||||
#define HSC_GET_RX HSC_IOW(20, struct hsc_rx_config)
|
||||
#define HSC_SET_TX HSC_IOW(21, struct hsc_tx_config)
|
||||
#define HSC_GET_TX HSC_IOW(22, struct hsc_tx_config)
|
||||
|
||||
#define HSC_PM_DISABLE 0
|
||||
#define HSC_PM_ENABLE 1
|
||||
|
||||
#define HSC_MODE_STREAM 1
|
||||
#define HSC_MODE_FRAME 2
|
||||
#define HSC_FLOW_SYNC 0
|
||||
#define HSC_ARB_RR 0
|
||||
#define HSC_ARB_PRIO 1
|
||||
|
||||
struct hsc_rx_config {
|
||||
uint32_t mode;
|
||||
uint32_t flow;
|
||||
uint32_t channels;
|
||||
};
|
||||
|
||||
struct hsc_tx_config {
|
||||
uint32_t mode;
|
||||
uint32_t channels;
|
||||
uint32_t speed;
|
||||
uint32_t arb_mode;
|
||||
};
|
||||
|
||||
#endif /* __HSI_CHAR_H */
|
||||
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef _LINUX_HWMON_SYSFS_H
|
||||
#define _LINUX_HWMON_SYSFS_H
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
struct sensor_device_attribute{
|
||||
struct device_attribute dev_attr;
|
||||
int index;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#ifndef _HWMON_H_
|
||||
#define _HWMON_H_
|
||||
|
||||
#include <linux/device.h>
|
||||
struct device;
|
||||
|
||||
struct device *hwmon_device_register(struct device *dev);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@
|
|||
|
||||
#include <linux/err.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
/* hwspinlock mode argument */
|
||||
#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
|
||||
#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
|
||||
|
||||
struct device;
|
||||
struct hwspinlock;
|
||||
struct hwspinlock_device;
|
||||
struct hwspinlock_ops;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
|
||||
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. */
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301 USA. */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
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. */
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301 USA. */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
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.
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_I2C_DEV_H
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@
|
|||
*
|
||||
* 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.
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_I2C_MUX_H
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
*
|
||||
* 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.
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_I2C_SMBUS_H
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
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. */
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301 USA. */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
|
||||
|
|
|
|||
|
|
@ -1,19 +1,42 @@
|
|||
/*
|
||||
* at24.h - platform_data for the at24 (generic eeprom) driver
|
||||
* (C) Copyright 2008 by Pengutronix
|
||||
* (C) Copyright 2012 by Wolfram Sang
|
||||
* same license as the driver
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_AT24_H
|
||||
#define _LINUX_AT24_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/memory.h>
|
||||
|
||||
/*
|
||||
* As seen through Linux I2C, differences between the most common types of I2C
|
||||
* memory include:
|
||||
* - How much memory is available (usually specified in bit)?
|
||||
* - What write page size does it support?
|
||||
* - Special flags (16 bit addresses, read_only, world readable...)?
|
||||
/**
|
||||
* struct at24_platform_data - data to set up at24 (generic eeprom) driver
|
||||
* @byte_len: size of eeprom in byte
|
||||
* @page_size: number of byte which can be written in one go
|
||||
* @flags: tunable options, check AT24_FLAG_* defines
|
||||
* @setup: an optional callback invoked after eeprom is probed; enables kernel
|
||||
code to access eeprom via memory_accessor, see example
|
||||
* @context: optional parameter passed to setup()
|
||||
*
|
||||
* If you set up a custom eeprom type, please double-check the parameters.
|
||||
* Especially page_size needs extra care, as you risk data loss if your value
|
||||
* is bigger than what the chip actually supports!
|
||||
*
|
||||
* An example in pseudo code for a setup() callback:
|
||||
*
|
||||
* void get_mac_addr(struct memory_accessor *mem_acc, void *context)
|
||||
* {
|
||||
* u8 *mac_addr = ethernet_pdata->mac_addr;
|
||||
* off_t offset = context;
|
||||
*
|
||||
* // Read MAC addr from EEPROM
|
||||
* if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN)
|
||||
* pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
|
||||
* }
|
||||
*
|
||||
* This function pointer and context can now be set up in at24_platform_data.
|
||||
*/
|
||||
|
||||
struct at24_platform_data {
|
||||
|
|
|
|||
|
|
@ -761,7 +761,7 @@ struct twl_regulator_driver_data {
|
|||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
int twl4030_sih_setup(int module);
|
||||
int twl4030_sih_setup(struct device *dev, int module, int irq_base);
|
||||
|
||||
/* Offsets to Power Registers */
|
||||
#define TWL4030_VDAC_DEV_GRP 0x3B
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#define I2O_MAX_DRIVERS 8
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/pm.h>
|
||||
|
|
@ -23,7 +22,6 @@
|
|||
#include <acpi/acpi.h>
|
||||
#endif
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
/* for request_sense */
|
||||
|
|
@ -43,6 +41,8 @@
|
|||
#define ERROR_RESET 3 /* Reset controller every 4th retry */
|
||||
#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
|
||||
|
||||
struct device;
|
||||
|
||||
/* Error codes returned in rq->errors to the higher part of the driver. */
|
||||
enum {
|
||||
IDE_DRV_ERROR_GENERAL = 101,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#define EQL_DEFAULT_SLAVE_PRIORITY 28800
|
||||
#define EQL_DEFAULT_MAX_SLAVES 4
|
||||
#define EQL_DEFAULT_MTU 576
|
||||
#define EQL_DEFAULT_RESCHED_IVAL 100
|
||||
#define EQL_DEFAULT_RESCHED_IVAL HZ
|
||||
|
||||
#define EQL_ENSLAVE (SIOCDEVPRIVATE)
|
||||
#define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
#define VLAN_HLEN 4 /* The additional bytes required by VLAN
|
||||
* (in addition to the Ethernet header)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include <linux/atomic.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
/*
|
||||
* These correspond to the IORESOURCE_IRQ_* defines in
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/bug.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@ struct resource {
|
|||
struct resource *parent, *sibling, *child;
|
||||
};
|
||||
|
||||
struct resource_list {
|
||||
struct resource_list *next;
|
||||
struct resource *res;
|
||||
struct pci_dev *dev;
|
||||
};
|
||||
|
||||
/*
|
||||
* IO resources have these defined flags.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -220,10 +220,10 @@ struct kernel_ipmi_msg {
|
|||
* The in-kernel interface.
|
||||
*/
|
||||
#include <linux/list.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
struct module;
|
||||
struct device;
|
||||
|
||||
/* Opaque type for a IPMI message user. One of these is needed to
|
||||
send and receive messages. */
|
||||
|
|
|
|||
|
|
@ -36,10 +36,11 @@
|
|||
|
||||
#include <linux/ipmi_msgdefs.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/ipmi.h>
|
||||
|
||||
struct device;
|
||||
|
||||
/* This files describes the interface for IPMI system management interface
|
||||
drivers to bind into the IPMI message handler. */
|
||||
|
||||
|
|
|
|||
|
|
@ -263,6 +263,11 @@ static inline void irqd_clr_chained_irq_inprogress(struct irq_data *d)
|
|||
d->state_use_accessors &= ~IRQD_IRQ_INPROGRESS;
|
||||
}
|
||||
|
||||
static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
|
||||
{
|
||||
return d->hwirq;
|
||||
}
|
||||
|
||||
/**
|
||||
* struct irq_chip - hardware interrupt chip descriptor
|
||||
*
|
||||
|
|
|
|||
|
|
@ -42,12 +42,6 @@ struct of_device_id;
|
|||
/* Number of irqs reserved for a legacy isa controller */
|
||||
#define NUM_ISA_INTERRUPTS 16
|
||||
|
||||
/* This type is the placeholder for a hardware interrupt number. It has to
|
||||
* be big enough to enclose whatever representation is used by a given
|
||||
* platform.
|
||||
*/
|
||||
typedef unsigned long irq_hw_number_t;
|
||||
|
||||
/**
|
||||
* struct irq_domain_ops - Methods for irq_domain objects
|
||||
* @match: Match an interrupt controller device node to a host, returns
|
||||
|
|
@ -104,6 +98,9 @@ struct irq_domain {
|
|||
unsigned int size;
|
||||
unsigned int *revmap;
|
||||
} linear;
|
||||
struct {
|
||||
unsigned int max_irq;
|
||||
} nomap;
|
||||
struct radix_tree_root tree;
|
||||
} revmap_data;
|
||||
const struct irq_domain_ops *ops;
|
||||
|
|
@ -126,6 +123,7 @@ struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
|
|||
const struct irq_domain_ops *ops,
|
||||
void *host_data);
|
||||
struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
|
||||
unsigned int max_irq,
|
||||
const struct irq_domain_ops *ops,
|
||||
void *host_data);
|
||||
struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
|
||||
|
|
@ -134,7 +132,6 @@ struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
|
|||
|
||||
extern struct irq_domain *irq_find_host(struct device_node *node);
|
||||
extern void irq_set_default_host(struct irq_domain *host);
|
||||
extern void irq_set_virq_count(unsigned int count);
|
||||
|
||||
static inline struct irq_domain *irq_domain_add_legacy_isa(
|
||||
struct device_node *of_node,
|
||||
|
|
@ -146,7 +143,6 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(
|
|||
}
|
||||
extern struct irq_domain *irq_find_host(struct device_node *node);
|
||||
extern void irq_set_default_host(struct irq_domain *host);
|
||||
extern void irq_set_virq_count(unsigned int count);
|
||||
|
||||
|
||||
extern unsigned int irq_create_mapping(struct irq_domain *host,
|
||||
|
|
|
|||
|
|
@ -971,6 +971,10 @@ extern void __journal_clean_data_list(transaction_t *transaction);
|
|||
/* Log buffer allocation */
|
||||
extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *);
|
||||
int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
|
||||
int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
|
||||
unsigned long *block);
|
||||
void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
|
||||
void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
|
||||
|
||||
/* Commit management */
|
||||
extern void jbd2_journal_commit_transaction(journal_t *);
|
||||
|
|
@ -1020,6 +1024,11 @@ jbd2_journal_write_metadata_buffer(transaction_t *transaction,
|
|||
/* Transaction locking */
|
||||
extern void __wait_on_journal (journal_t *);
|
||||
|
||||
/* Transaction cache support */
|
||||
extern void jbd2_journal_destroy_transaction_cache(void);
|
||||
extern int jbd2_journal_init_transaction_cache(void);
|
||||
extern void jbd2_journal_free_transaction(transaction_t *);
|
||||
|
||||
/*
|
||||
* Journal locking.
|
||||
*
|
||||
|
|
@ -1082,7 +1091,8 @@ extern int jbd2_journal_destroy (journal_t *);
|
|||
extern int jbd2_journal_recover (journal_t *journal);
|
||||
extern int jbd2_journal_wipe (journal_t *, int);
|
||||
extern int jbd2_journal_skip_recovery (journal_t *);
|
||||
extern void jbd2_journal_update_superblock (journal_t *, int);
|
||||
extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t,
|
||||
unsigned long, int);
|
||||
extern void __jbd2_journal_abort_hard (journal_t *);
|
||||
extern void jbd2_journal_abort (journal_t *, int);
|
||||
extern int jbd2_journal_errno (journal_t *);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ struct journal_head {
|
|||
* transaction (if there is one). Only applies to buffers on a
|
||||
* transaction's data or metadata journaling list.
|
||||
* [j_list_lock] [jbd_lock_bh_state()]
|
||||
* Either of these locks is enough for reading, both are needed for
|
||||
* changes.
|
||||
*/
|
||||
transaction_t *b_transaction;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#ifndef __LINUX_JZ4740_ADC
|
||||
#define __LINUX_JZ4740_ADC
|
||||
|
||||
#include <linux/device.h>
|
||||
struct device;
|
||||
|
||||
/*
|
||||
* jz4740_adc_set_config - Configure a JZ4740 adc device
|
||||
|
|
|
|||
|
|
@ -4,29 +4,43 @@
|
|||
#include <generated/autoconf.h>
|
||||
|
||||
/*
|
||||
* Helper macros to use CONFIG_ options in C expressions. Note that
|
||||
* Helper macros to use CONFIG_ options in C/CPP expressions. Note that
|
||||
* these only work with boolean and tristate options.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Getting something that works in C and CPP for an arg that may or may
|
||||
* not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1"
|
||||
* we match on the placeholder define, insert the "0," for arg1 and generate
|
||||
* the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one).
|
||||
* When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when
|
||||
* the last step cherry picks the 2nd arg, we get a zero.
|
||||
*/
|
||||
#define __ARG_PLACEHOLDER_1 0,
|
||||
#define config_enabled(cfg) _config_enabled(cfg)
|
||||
#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
|
||||
#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
|
||||
#define ___config_enabled(__ignored, val, ...) val
|
||||
|
||||
/*
|
||||
* IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
|
||||
* 0 otherwise.
|
||||
*
|
||||
*/
|
||||
#define IS_ENABLED(option) \
|
||||
(__enabled_ ## option || __enabled_ ## option ## _MODULE)
|
||||
(config_enabled(option) || config_enabled(option##_MODULE))
|
||||
|
||||
/*
|
||||
* IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0
|
||||
* otherwise. For boolean options, this is equivalent to
|
||||
* IS_ENABLED(CONFIG_FOO).
|
||||
*/
|
||||
#define IS_BUILTIN(option) __enabled_ ## option
|
||||
#define IS_BUILTIN(option) config_enabled(option)
|
||||
|
||||
/*
|
||||
* IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0
|
||||
* otherwise.
|
||||
*/
|
||||
#define IS_MODULE(option) __enabled_ ## option ## _MODULE
|
||||
#define IS_MODULE(option) config_enabled(option##_MODULE)
|
||||
|
||||
#endif /* __LINUX_KCONFIG_H */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _LINUX_KERNEL_H
|
||||
#define _LINUX_KERNEL_H
|
||||
|
||||
#include <linux/sysinfo.h>
|
||||
|
||||
/*
|
||||
* 'kernel.h' contains some often-used function prototypes etc
|
||||
*/
|
||||
|
|
@ -20,7 +22,6 @@
|
|||
#include <linux/printk.h>
|
||||
#include <linux/dynamic_debug.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/bug.h>
|
||||
|
||||
#define USHRT_MAX ((u16)(~0U))
|
||||
#define SHRT_MAX ((s16)(USHRT_MAX>>1))
|
||||
|
|
@ -312,6 +313,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int);
|
|||
#define strict_strtoull kstrtoull
|
||||
#define strict_strtoll kstrtoll
|
||||
|
||||
extern int num_to_str(char *buf, int size, unsigned long long num);
|
||||
|
||||
/* lib/printf utilities */
|
||||
|
||||
extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...);
|
||||
|
|
@ -427,16 +430,10 @@ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
|
|||
* Most likely, you want to use tracing_on/tracing_off.
|
||||
*/
|
||||
#ifdef CONFIG_RING_BUFFER
|
||||
void tracing_on(void);
|
||||
void tracing_off(void);
|
||||
/* trace_off_permanent stops recording with no way to bring it back */
|
||||
void tracing_off_permanent(void);
|
||||
int tracing_is_on(void);
|
||||
#else
|
||||
static inline void tracing_on(void) { }
|
||||
static inline void tracing_off(void) { }
|
||||
static inline void tracing_off_permanent(void) { }
|
||||
static inline int tracing_is_on(void) { return 0; }
|
||||
#endif
|
||||
|
||||
enum ftrace_dump_mode {
|
||||
|
|
@ -446,6 +443,10 @@ enum ftrace_dump_mode {
|
|||
};
|
||||
|
||||
#ifdef CONFIG_TRACING
|
||||
void tracing_on(void);
|
||||
void tracing_off(void);
|
||||
int tracing_is_on(void);
|
||||
|
||||
extern void tracing_start(void);
|
||||
extern void tracing_stop(void);
|
||||
extern void ftrace_off_permanent(void);
|
||||
|
|
@ -530,6 +531,11 @@ static inline void tracing_start(void) { }
|
|||
static inline void tracing_stop(void) { }
|
||||
static inline void ftrace_off_permanent(void) { }
|
||||
static inline void trace_dump_stack(void) { }
|
||||
|
||||
static inline void tracing_on(void) { }
|
||||
static inline void tracing_off(void) { }
|
||||
static inline int tracing_is_on(void) { return 0; }
|
||||
|
||||
static inline int
|
||||
trace_printk(const char *fmt, ...)
|
||||
{
|
||||
|
|
@ -675,67 +681,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
|
|||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
|
||||
#define BUILD_BUG_ON_ZERO(e) (0)
|
||||
#define BUILD_BUG_ON_NULL(e) ((void*)0)
|
||||
#define BUILD_BUG_ON(condition)
|
||||
#define BUILD_BUG() (0)
|
||||
#else /* __CHECKER__ */
|
||||
|
||||
/* Force a compilation error if a constant expression is not a power of 2 */
|
||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
|
||||
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
|
||||
|
||||
/* Force a compilation error if condition is true, but also produce a
|
||||
result (of value 0 and type size_t), so the expression can be used
|
||||
e.g. in a structure initializer (or where-ever else comma expressions
|
||||
aren't permitted). */
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
|
||||
|
||||
/**
|
||||
* BUILD_BUG_ON - break compile if a condition is true.
|
||||
* @condition: the condition which the compiler should know is false.
|
||||
*
|
||||
* If you have some code which relies on certain constants being equal, or
|
||||
* other compile-time-evaluated condition, you should use BUILD_BUG_ON to
|
||||
* detect if someone changes it.
|
||||
*
|
||||
* The implementation uses gcc's reluctance to create a negative array, but
|
||||
* gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
|
||||
* to inline functions). So as a fallback we use the optimizer; if it can't
|
||||
* prove the condition is false, it will cause a link error on the undefined
|
||||
* "__build_bug_on_failed". This error message can be harder to track down
|
||||
* though, hence the two different methods.
|
||||
*/
|
||||
#ifndef __OPTIMIZE__
|
||||
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
||||
#else
|
||||
extern int __build_bug_on_failed;
|
||||
#define BUILD_BUG_ON(condition) \
|
||||
do { \
|
||||
((void)sizeof(char[1 - 2*!!(condition)])); \
|
||||
if (condition) __build_bug_on_failed = 1; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* BUILD_BUG - break compile if used.
|
||||
*
|
||||
* If you have some code that you expect the compiler to eliminate at
|
||||
* build time, you should use BUILD_BUG to detect if it is
|
||||
* unexpectedly used.
|
||||
*/
|
||||
#define BUILD_BUG() \
|
||||
do { \
|
||||
extern void __build_bug_failed(void) \
|
||||
__linktime_error("BUILD_BUG failed"); \
|
||||
__build_bug_failed(); \
|
||||
} while (0)
|
||||
|
||||
#endif /* __CHECKER__ */
|
||||
|
||||
/* Trap pasters of __FUNCTION__ at compile-time */
|
||||
#define __FUNCTION__ (__func__)
|
||||
|
||||
|
|
@ -758,27 +703,8 @@ extern int __build_bug_on_failed;
|
|||
# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
|
||||
#endif
|
||||
|
||||
struct sysinfo;
|
||||
extern int do_sysinfo(struct sysinfo *info);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#define SI_LOAD_SHIFT 16
|
||||
struct sysinfo {
|
||||
long uptime; /* Seconds since boot */
|
||||
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
|
||||
unsigned long totalram; /* Total usable main memory size */
|
||||
unsigned long freeram; /* Available memory size */
|
||||
unsigned long sharedram; /* Amount of shared memory */
|
||||
unsigned long bufferram; /* Memory used by buffers */
|
||||
unsigned long totalswap; /* Total swap space size */
|
||||
unsigned long freeswap; /* swap space still available */
|
||||
unsigned short procs; /* Number of current processes */
|
||||
unsigned short pad; /* explicit padding for m68k */
|
||||
unsigned long totalhigh; /* Total high memory size */
|
||||
unsigned long freehigh; /* Available high memory size */
|
||||
unsigned int mem_unit; /* Memory unit size in bytes */
|
||||
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ enum kgdb_bptype {
|
|||
BP_HARDWARE_BREAKPOINT,
|
||||
BP_WRITE_WATCHPOINT,
|
||||
BP_READ_WATCHPOINT,
|
||||
BP_ACCESS_WATCHPOINT
|
||||
BP_ACCESS_WATCHPOINT,
|
||||
BP_POKE_BREAKPOINT,
|
||||
};
|
||||
|
||||
enum kgdb_bpstate {
|
||||
|
|
@ -207,8 +208,8 @@ extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
|
|||
|
||||
/* Optional functions. */
|
||||
extern int kgdb_validate_break_address(unsigned long addr);
|
||||
extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
|
||||
extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle);
|
||||
extern int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt);
|
||||
extern int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt);
|
||||
|
||||
/**
|
||||
* kgdb_arch_late - Perform any architecture specific initalization.
|
||||
|
|
|
|||
|
|
@ -48,11 +48,10 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
|
|||
struct cred;
|
||||
struct file;
|
||||
|
||||
enum umh_wait {
|
||||
UMH_NO_WAIT = -1, /* don't wait at all */
|
||||
UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */
|
||||
UMH_WAIT_PROC = 1, /* wait for the process to complete */
|
||||
};
|
||||
#define UMH_NO_WAIT 0 /* don't wait at all */
|
||||
#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */
|
||||
#define UMH_WAIT_PROC 2 /* wait for the process to complete */
|
||||
#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */
|
||||
|
||||
struct subprocess_info {
|
||||
struct work_struct work;
|
||||
|
|
@ -60,7 +59,7 @@ struct subprocess_info {
|
|||
char *path;
|
||||
char **argv;
|
||||
char **envp;
|
||||
enum umh_wait wait;
|
||||
int wait;
|
||||
int retval;
|
||||
int (*init)(struct subprocess_info *info, struct cred *new);
|
||||
void (*cleanup)(struct subprocess_info *info);
|
||||
|
|
@ -78,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
|
|||
void *data);
|
||||
|
||||
/* Actually execute the sub-process */
|
||||
int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
|
||||
int call_usermodehelper_exec(struct subprocess_info *info, int wait);
|
||||
|
||||
/* Free the subprocess_info. This is only needed if you're not going
|
||||
to call call_usermodehelper_exec */
|
||||
void call_usermodehelper_freeinfo(struct subprocess_info *info);
|
||||
|
||||
static inline int
|
||||
call_usermodehelper_fns(char *path, char **argv, char **envp,
|
||||
enum umh_wait wait,
|
||||
call_usermodehelper_fns(char *path, char **argv, char **envp, int wait,
|
||||
int (*init)(struct subprocess_info *info, struct cred *new),
|
||||
void (*cleanup)(struct subprocess_info *), void *data)
|
||||
{
|
||||
|
|
@ -104,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
|
|||
}
|
||||
|
||||
static inline int
|
||||
call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
|
||||
call_usermodehelper(char *path, char **argv, char **envp, int wait)
|
||||
{
|
||||
return call_usermodehelper_fns(path, argv, envp, wait,
|
||||
NULL, NULL, NULL);
|
||||
|
|
@ -112,12 +110,29 @@ call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
|
|||
|
||||
extern struct ctl_table usermodehelper_table[];
|
||||
|
||||
enum umh_disable_depth {
|
||||
UMH_ENABLED = 0,
|
||||
UMH_FREEZING,
|
||||
UMH_DISABLED,
|
||||
};
|
||||
|
||||
extern void usermodehelper_init(void);
|
||||
|
||||
extern int usermodehelper_disable(void);
|
||||
extern void usermodehelper_enable(void);
|
||||
extern bool usermodehelper_is_disabled(void);
|
||||
extern void read_lock_usermodehelper(void);
|
||||
extern void read_unlock_usermodehelper(void);
|
||||
extern int __usermodehelper_disable(enum umh_disable_depth depth);
|
||||
extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth);
|
||||
|
||||
static inline int usermodehelper_disable(void)
|
||||
{
|
||||
return __usermodehelper_disable(UMH_DISABLED);
|
||||
}
|
||||
|
||||
static inline void usermodehelper_enable(void)
|
||||
{
|
||||
__usermodehelper_set_disable_depth(UMH_ENABLED);
|
||||
}
|
||||
|
||||
extern int usermodehelper_read_trylock(void);
|
||||
extern long usermodehelper_read_lock_wait(long timeout);
|
||||
extern void usermodehelper_read_unlock(void);
|
||||
|
||||
#endif /* __LINUX_KMOD_H__ */
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/rcupdate.h>
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ struct kvm_pit_config {
|
|||
#define KVM_EXIT_INTERNAL_ERROR 17
|
||||
#define KVM_EXIT_OSI 18
|
||||
#define KVM_EXIT_PAPR_HCALL 19
|
||||
#define KVM_EXIT_S390_UCONTROL 20
|
||||
|
||||
/* For KVM_EXIT_INTERNAL_ERROR */
|
||||
#define KVM_INTERNAL_ERROR_EMULATION 1
|
||||
|
|
@ -249,6 +250,11 @@ struct kvm_run {
|
|||
#define KVM_S390_RESET_CPU_INIT 8
|
||||
#define KVM_S390_RESET_IPL 16
|
||||
__u64 s390_reset_flags;
|
||||
/* KVM_EXIT_S390_UCONTROL */
|
||||
struct {
|
||||
__u64 trans_exc_code;
|
||||
__u32 pgm_code;
|
||||
} s390_ucontrol;
|
||||
/* KVM_EXIT_DCR */
|
||||
struct {
|
||||
__u32 dcrn;
|
||||
|
|
@ -273,6 +279,20 @@ struct kvm_run {
|
|||
/* Fix the size of the union. */
|
||||
char padding[256];
|
||||
};
|
||||
|
||||
/*
|
||||
* shared registers between kvm and userspace.
|
||||
* kvm_valid_regs specifies the register classes set by the host
|
||||
* kvm_dirty_regs specified the register classes dirtied by userspace
|
||||
* struct kvm_sync_regs is architecture specific, as well as the
|
||||
* bits for kvm_valid_regs and kvm_dirty_regs
|
||||
*/
|
||||
__u64 kvm_valid_regs;
|
||||
__u64 kvm_dirty_regs;
|
||||
union {
|
||||
struct kvm_sync_regs regs;
|
||||
char padding[1024];
|
||||
} s;
|
||||
};
|
||||
|
||||
/* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */
|
||||
|
|
@ -431,6 +451,11 @@ struct kvm_ppc_pvinfo {
|
|||
|
||||
#define KVMIO 0xAE
|
||||
|
||||
/* machine type bits, to be used as argument to KVM_CREATE_VM */
|
||||
#define KVM_VM_S390_UCONTROL 1
|
||||
|
||||
#define KVM_S390_SIE_PAGE_OFFSET 1
|
||||
|
||||
/*
|
||||
* ioctls for /dev/kvm fds:
|
||||
*/
|
||||
|
|
@ -555,9 +580,15 @@ struct kvm_ppc_pvinfo {
|
|||
#define KVM_CAP_PPC_SMT 64
|
||||
#define KVM_CAP_PPC_RMA 65
|
||||
#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */
|
||||
#define KVM_CAP_PPC_HIOR 67
|
||||
#define KVM_CAP_PPC_PAPR 68
|
||||
#define KVM_CAP_SW_TLB 69
|
||||
#define KVM_CAP_ONE_REG 70
|
||||
#define KVM_CAP_S390_GMAP 71
|
||||
#define KVM_CAP_TSC_DEADLINE_TIMER 72
|
||||
#define KVM_CAP_S390_UCONTROL 73
|
||||
#define KVM_CAP_SYNC_REGS 74
|
||||
#define KVM_CAP_PCI_2_3 75
|
||||
|
||||
#ifdef KVM_CAP_IRQ_ROUTING
|
||||
|
||||
|
|
@ -637,6 +668,52 @@ struct kvm_clock_data {
|
|||
__u32 pad[9];
|
||||
};
|
||||
|
||||
#define KVM_MMU_FSL_BOOKE_NOHV 0
|
||||
#define KVM_MMU_FSL_BOOKE_HV 1
|
||||
|
||||
struct kvm_config_tlb {
|
||||
__u64 params;
|
||||
__u64 array;
|
||||
__u32 mmu_type;
|
||||
__u32 array_len;
|
||||
};
|
||||
|
||||
struct kvm_dirty_tlb {
|
||||
__u64 bitmap;
|
||||
__u32 num_dirty;
|
||||
};
|
||||
|
||||
/* Available with KVM_CAP_ONE_REG */
|
||||
|
||||
#define KVM_REG_ARCH_MASK 0xff00000000000000ULL
|
||||
#define KVM_REG_GENERIC 0x0000000000000000ULL
|
||||
|
||||
/*
|
||||
* Architecture specific registers are to be defined in arch headers and
|
||||
* ORed with the arch identifier.
|
||||
*/
|
||||
#define KVM_REG_PPC 0x1000000000000000ULL
|
||||
#define KVM_REG_X86 0x2000000000000000ULL
|
||||
#define KVM_REG_IA64 0x3000000000000000ULL
|
||||
#define KVM_REG_ARM 0x4000000000000000ULL
|
||||
#define KVM_REG_S390 0x5000000000000000ULL
|
||||
|
||||
#define KVM_REG_SIZE_SHIFT 52
|
||||
#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
|
||||
#define KVM_REG_SIZE_U8 0x0000000000000000ULL
|
||||
#define KVM_REG_SIZE_U16 0x0010000000000000ULL
|
||||
#define KVM_REG_SIZE_U32 0x0020000000000000ULL
|
||||
#define KVM_REG_SIZE_U64 0x0030000000000000ULL
|
||||
#define KVM_REG_SIZE_U128 0x0040000000000000ULL
|
||||
#define KVM_REG_SIZE_U256 0x0050000000000000ULL
|
||||
#define KVM_REG_SIZE_U512 0x0060000000000000ULL
|
||||
#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
|
||||
|
||||
struct kvm_one_reg {
|
||||
__u64 id;
|
||||
__u64 addr;
|
||||
};
|
||||
|
||||
/*
|
||||
* ioctls for VM fds
|
||||
*/
|
||||
|
|
@ -655,6 +732,17 @@ struct kvm_clock_data {
|
|||
struct kvm_userspace_memory_region)
|
||||
#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
|
||||
#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
|
||||
|
||||
/* enable ucontrol for s390 */
|
||||
struct kvm_s390_ucas_mapping {
|
||||
__u64 user_addr;
|
||||
__u64 vcpu_addr;
|
||||
__u64 length;
|
||||
};
|
||||
#define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
|
||||
#define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
|
||||
#define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
|
||||
|
||||
/* Device model IOC */
|
||||
#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
|
||||
#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
|
||||
|
|
@ -697,6 +785,9 @@ struct kvm_clock_data {
|
|||
/* Available with KVM_CAP_TSC_CONTROL */
|
||||
#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
|
||||
#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
|
||||
/* Available with KVM_CAP_PCI_2_3 */
|
||||
#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \
|
||||
struct kvm_assigned_pci_dev)
|
||||
|
||||
/*
|
||||
* ioctls for vcpu fds
|
||||
|
|
@ -763,8 +854,15 @@ struct kvm_clock_data {
|
|||
#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
|
||||
/* Available with KVM_CAP_RMA */
|
||||
#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
|
||||
/* Available with KVM_CAP_SW_TLB */
|
||||
#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
|
||||
/* Available with KVM_CAP_ONE_REG */
|
||||
#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg)
|
||||
#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
|
||||
|
||||
#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
|
||||
#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
|
||||
#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)
|
||||
|
||||
struct kvm_assigned_pci_dev {
|
||||
__u32 assigned_dev_id;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <linux/spinlock.h>
|
||||
#include <linux/signal.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/mmu_notifier.h>
|
||||
#include <linux/preempt.h>
|
||||
|
|
@ -171,11 +172,6 @@ static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
|
|||
*/
|
||||
#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1)
|
||||
|
||||
struct kvm_lpage_info {
|
||||
unsigned long rmap_pde;
|
||||
int write_count;
|
||||
};
|
||||
|
||||
struct kvm_memory_slot {
|
||||
gfn_t base_gfn;
|
||||
unsigned long npages;
|
||||
|
|
@ -184,7 +180,7 @@ struct kvm_memory_slot {
|
|||
unsigned long *dirty_bitmap;
|
||||
unsigned long *dirty_bitmap_head;
|
||||
unsigned long nr_dirty_pages;
|
||||
struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
|
||||
struct kvm_arch_memory_slot arch;
|
||||
unsigned long userspace_addr;
|
||||
int user_alloc;
|
||||
int id;
|
||||
|
|
@ -376,6 +372,9 @@ int kvm_set_memory_region(struct kvm *kvm,
|
|||
int __kvm_set_memory_region(struct kvm *kvm,
|
||||
struct kvm_userspace_memory_region *mem,
|
||||
int user_alloc);
|
||||
void kvm_arch_free_memslot(struct kvm_memory_slot *free,
|
||||
struct kvm_memory_slot *dont);
|
||||
int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
|
||||
int kvm_arch_prepare_memory_region(struct kvm *kvm,
|
||||
struct kvm_memory_slot *memslot,
|
||||
struct kvm_memory_slot old,
|
||||
|
|
@ -385,6 +384,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
|
|||
struct kvm_userspace_memory_region *mem,
|
||||
struct kvm_memory_slot old,
|
||||
int user_alloc);
|
||||
bool kvm_largepages_enabled(void);
|
||||
void kvm_disable_largepages(void);
|
||||
void kvm_arch_flush_shadow(struct kvm *kvm);
|
||||
|
||||
|
|
@ -450,6 +450,7 @@ 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);
|
||||
int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf);
|
||||
|
||||
int kvm_dev_ioctl_check_extension(long ext);
|
||||
|
||||
|
|
@ -520,7 +521,7 @@ static inline void kvm_arch_free_vm(struct kvm *kvm)
|
|||
}
|
||||
#endif
|
||||
|
||||
int kvm_arch_init_vm(struct kvm *kvm);
|
||||
int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
|
||||
void kvm_arch_destroy_vm(struct kvm *kvm);
|
||||
void kvm_free_all_assigned_devices(struct kvm *kvm);
|
||||
void kvm_arch_sync_events(struct kvm *kvm);
|
||||
|
|
@ -546,6 +547,7 @@ struct kvm_assigned_dev_kernel {
|
|||
unsigned int entries_nr;
|
||||
int host_irq;
|
||||
bool host_irq_disabled;
|
||||
bool pci_2_3;
|
||||
struct msix_entry *host_msix_entries;
|
||||
int guest_irq;
|
||||
struct msix_entry *guest_msix_entries;
|
||||
|
|
@ -555,6 +557,7 @@ struct kvm_assigned_dev_kernel {
|
|||
struct pci_dev *dev;
|
||||
struct kvm *kvm;
|
||||
spinlock_t intx_lock;
|
||||
spinlock_t intx_mask_lock;
|
||||
char irq_name[32];
|
||||
struct pci_saved_state *pci_saved_state;
|
||||
};
|
||||
|
|
@ -650,11 +653,43 @@ static inline void kvm_guest_exit(void)
|
|||
current->flags &= ~PF_VCPU;
|
||||
}
|
||||
|
||||
/*
|
||||
* search_memslots() and __gfn_to_memslot() are here because they are
|
||||
* used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c.
|
||||
* gfn_to_memslot() itself isn't here as an inline because that would
|
||||
* bloat other code too much.
|
||||
*/
|
||||
static inline struct kvm_memory_slot *
|
||||
search_memslots(struct kvm_memslots *slots, gfn_t gfn)
|
||||
{
|
||||
struct kvm_memory_slot *memslot;
|
||||
|
||||
kvm_for_each_memslot(memslot, slots)
|
||||
if (gfn >= memslot->base_gfn &&
|
||||
gfn < memslot->base_gfn + memslot->npages)
|
||||
return memslot;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct kvm_memory_slot *
|
||||
__gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn)
|
||||
{
|
||||
return search_memslots(slots, gfn);
|
||||
}
|
||||
|
||||
static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
|
||||
{
|
||||
return gfn_to_memslot(kvm, gfn)->id;
|
||||
}
|
||||
|
||||
static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
|
||||
{
|
||||
/* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */
|
||||
return (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
|
||||
(base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
|
||||
}
|
||||
|
||||
static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot,
|
||||
gfn_t gfn)
|
||||
{
|
||||
|
|
@ -701,12 +736,16 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
|
|||
if (unlikely(vcpu->kvm->mmu_notifier_count))
|
||||
return 1;
|
||||
/*
|
||||
* Both reads happen under the mmu_lock and both values are
|
||||
* modified under mmu_lock, so there's no need of smb_rmb()
|
||||
* here in between, otherwise mmu_notifier_count should be
|
||||
* read before mmu_notifier_seq, see
|
||||
* mmu_notifier_invalidate_range_end write side.
|
||||
* Ensure the read of mmu_notifier_count happens before the read
|
||||
* of mmu_notifier_seq. This interacts with the smp_wmb() in
|
||||
* mmu_notifier_invalidate_range_end to make sure that the caller
|
||||
* either sees the old (non-zero) value of mmu_notifier_count or
|
||||
* the new (incremented) value of mmu_notifier_seq.
|
||||
* PowerPC Book3s HV KVM calls this under a per-page lock
|
||||
* rather than under kvm->mmu_lock, for scalability, so
|
||||
* can't rely on kvm->mmu_lock to keep things ordered.
|
||||
*/
|
||||
smp_rmb();
|
||||
if (vcpu->kvm->mmu_notifier_seq != mmu_seq)
|
||||
return 1;
|
||||
return 0;
|
||||
|
|
@ -769,6 +808,13 @@ static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
|
|||
{
|
||||
return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
|
||||
}
|
||||
|
||||
bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu);
|
||||
|
||||
#else
|
||||
|
||||
static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; }
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/cmpxchg.h>
|
||||
|
||||
struct llist_head {
|
||||
struct llist_node *first;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
/*
|
||||
* LP8727 Micro/Mini USB IC with integrated charger
|
||||
*
|
||||
* Copyright (C) 2011 Texas Instruments
|
||||
* Copyright (C) 2011 National Semiconductor
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -32,13 +35,24 @@ enum lp8727_ichg {
|
|||
ICHG_1000mA,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct lp8727_chg_param
|
||||
* @eoc_level : end of charge level setting
|
||||
* @ichg : charging current
|
||||
*/
|
||||
struct lp8727_chg_param {
|
||||
/* end of charge level setting */
|
||||
enum lp8727_eoc_level eoc_level;
|
||||
/* charging current */
|
||||
enum lp8727_ichg ichg;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct lp8727_platform_data
|
||||
* @get_batt_present : check battery status - exists or not
|
||||
* @get_batt_level : get battery voltage (mV)
|
||||
* @get_batt_capacity : get battery capacity (%)
|
||||
* @get_batt_temp : get battery temperature
|
||||
* @ac, @usb : charging parameters each charger type
|
||||
*/
|
||||
struct lp8727_platform_data {
|
||||
u8 (*get_batt_present)(void);
|
||||
u16 (*get_batt_level)(void);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,24 @@
|
|||
#include <linux/path.h>
|
||||
#include <linux/key.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
struct lsm_network_audit {
|
||||
int netif;
|
||||
struct sock *sk;
|
||||
u16 family;
|
||||
__be16 dport;
|
||||
__be16 sport;
|
||||
union {
|
||||
struct {
|
||||
__be32 daddr;
|
||||
__be32 saddr;
|
||||
} v4;
|
||||
struct {
|
||||
struct in6_addr daddr;
|
||||
struct in6_addr saddr;
|
||||
} v6;
|
||||
} fam;
|
||||
};
|
||||
|
||||
/* Auxiliary data to use in generating the audit record. */
|
||||
struct common_audit_data {
|
||||
|
|
@ -42,23 +58,7 @@ struct common_audit_data {
|
|||
struct path path;
|
||||
struct dentry *dentry;
|
||||
struct inode *inode;
|
||||
struct {
|
||||
int netif;
|
||||
struct sock *sk;
|
||||
u16 family;
|
||||
__be16 dport;
|
||||
__be16 sport;
|
||||
union {
|
||||
struct {
|
||||
__be32 daddr;
|
||||
__be32 saddr;
|
||||
} v4;
|
||||
struct {
|
||||
struct in6_addr daddr;
|
||||
struct in6_addr saddr;
|
||||
} v6;
|
||||
} fam;
|
||||
} net;
|
||||
struct lsm_network_audit *net;
|
||||
int cap;
|
||||
int ipc_id;
|
||||
struct task_struct *tsk;
|
||||
|
|
@ -73,64 +73,15 @@ struct common_audit_data {
|
|||
/* this union contains LSM specific data */
|
||||
union {
|
||||
#ifdef CONFIG_SECURITY_SMACK
|
||||
/* SMACK data */
|
||||
struct smack_audit_data {
|
||||
const char *function;
|
||||
char *subject;
|
||||
char *object;
|
||||
char *request;
|
||||
int result;
|
||||
} smack_audit_data;
|
||||
struct smack_audit_data *smack_audit_data;
|
||||
#endif
|
||||
#ifdef CONFIG_SECURITY_SELINUX
|
||||
/* SELinux data */
|
||||
struct {
|
||||
u32 ssid;
|
||||
u32 tsid;
|
||||
u16 tclass;
|
||||
u32 requested;
|
||||
u32 audited;
|
||||
u32 denied;
|
||||
/*
|
||||
* auditdeny is a bit tricky and unintuitive. See the
|
||||
* comments in avc.c for it's meaning and usage.
|
||||
*/
|
||||
u32 auditdeny;
|
||||
struct av_decision *avd;
|
||||
int result;
|
||||
} selinux_audit_data;
|
||||
struct selinux_audit_data *selinux_audit_data;
|
||||
#endif
|
||||
#ifdef CONFIG_SECURITY_APPARMOR
|
||||
struct {
|
||||
int error;
|
||||
int op;
|
||||
int type;
|
||||
void *profile;
|
||||
const char *name;
|
||||
const char *info;
|
||||
union {
|
||||
void *target;
|
||||
struct {
|
||||
long pos;
|
||||
void *target;
|
||||
} iface;
|
||||
struct {
|
||||
int rlim;
|
||||
unsigned long max;
|
||||
} rlim;
|
||||
struct {
|
||||
const char *target;
|
||||
u32 request;
|
||||
u32 denied;
|
||||
uid_t ouid;
|
||||
} fs;
|
||||
};
|
||||
} apparmor_audit_data;
|
||||
struct apparmor_audit_data *apparmor_audit_data;
|
||||
#endif
|
||||
};
|
||||
/* these callback will be implemented by a specific LSM */
|
||||
void (*lsm_pre_audit)(struct audit_buffer *, void *);
|
||||
void (*lsm_post_audit)(struct audit_buffer *, void *);
|
||||
}; /* per LSM data pointer union */
|
||||
};
|
||||
|
||||
#define v4info fam.v4
|
||||
|
|
@ -147,6 +98,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb,
|
|||
{ memset((_d), 0, sizeof(struct common_audit_data)); \
|
||||
(_d)->type = LSM_AUDIT_DATA_##_t; }
|
||||
|
||||
void common_lsm_audit(struct common_audit_data *a);
|
||||
void common_lsm_audit(struct common_audit_data *a,
|
||||
void (*pre_audit)(struct audit_buffer *, void *),
|
||||
void (*post_audit)(struct audit_buffer *, void *));
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef __LINUX_MAPLE_H
|
||||
#define __LINUX_MAPLE_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <mach/maple.h>
|
||||
|
||||
struct device;
|
||||
extern struct bus_type maple_bus_type;
|
||||
|
||||
/* Maple Bus command and response codes */
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue