include/sound/info.h
changeset 2 d1f6d8b6f81c
parent 0 aa628870c1d3
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
    38 #define SNDRV_INFO_CONTENT_DATA		1
    38 #define SNDRV_INFO_CONTENT_DATA		1
    39 
    39 
    40 struct snd_info_entry;
    40 struct snd_info_entry;
    41 
    41 
    42 struct snd_info_entry_text {
    42 struct snd_info_entry_text {
    43 	void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
    43 	void (*read)(struct snd_info_entry *entry,
    44 	void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
    44 		     struct snd_info_buffer *buffer);
       
    45 	void (*write)(struct snd_info_entry *entry,
       
    46 		      struct snd_info_buffer *buffer);
    45 };
    47 };
    46 
    48 
    47 struct snd_info_entry_ops {
    49 struct snd_info_entry_ops {
    48 	int (*open) (struct snd_info_entry *entry,
    50 	int (*open)(struct snd_info_entry *entry,
    49 		     unsigned short mode, void **file_private_data);
    51 		    unsigned short mode, void **file_private_data);
    50 	int (*release) (struct snd_info_entry * entry,
    52 	int (*release)(struct snd_info_entry *entry,
    51 			unsigned short mode, void *file_private_data);
    53 		       unsigned short mode, void *file_private_data);
    52 	long (*read) (struct snd_info_entry *entry, void *file_private_data,
    54 	long (*read)(struct snd_info_entry *entry, void *file_private_data,
    53 		      struct file * file, char __user *buf,
    55 		     struct file *file, char __user *buf,
       
    56 		     unsigned long count, unsigned long pos);
       
    57 	long (*write)(struct snd_info_entry *entry, void *file_private_data,
       
    58 		      struct file *file, const char __user *buf,
    54 		      unsigned long count, unsigned long pos);
    59 		      unsigned long count, unsigned long pos);
    55 	long (*write) (struct snd_info_entry *entry, void *file_private_data,
    60 	long long (*llseek)(struct snd_info_entry *entry,
    56 		       struct file * file, const char __user *buf,
    61 			    void *file_private_data, struct file *file,
    57 		       unsigned long count, unsigned long pos);
    62 			    long long offset, int orig);
    58 	long long (*llseek) (struct snd_info_entry *entry, void *file_private_data,
    63 	unsigned int(*poll)(struct snd_info_entry *entry,
    59 			    struct file * file, long long offset, int orig);
    64 			    void *file_private_data, struct file *file,
    60 	unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data,
    65 			    poll_table *wait);
    61 			      struct file * file, poll_table * wait);
    66 	int (*ioctl)(struct snd_info_entry *entry, void *file_private_data,
    62 	int (*ioctl) (struct snd_info_entry *entry, void *file_private_data,
    67 		     struct file *file, unsigned int cmd, unsigned long arg);
    63 		      struct file * file, unsigned int cmd, unsigned long arg);
    68 	int (*mmap)(struct snd_info_entry *entry, void *file_private_data,
    64 	int (*mmap) (struct snd_info_entry *entry, void *file_private_data,
    69 		    struct inode *inode, struct file *file,
    65 		     struct inode * inode, struct file * file,
    70 		    struct vm_area_struct *vma);
    66 		     struct vm_area_struct * vma);
       
    67 };
    71 };
    68 
    72 
    69 struct snd_info_entry {
    73 struct snd_info_entry {
    70 	const char *name;
    74 	const char *name;
    71 	mode_t mode;
    75 	mode_t mode;
   104 #else
   108 #else
   105 #define snd_oss_root NULL
   109 #define snd_oss_root NULL
   106 static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {}
   110 static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {}
   107 #endif
   111 #endif
   108 
   112 
   109 int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3)));
   113 int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) \
       
   114 				__attribute__ ((format (printf, 2, 3)));
   110 int snd_info_init(void);
   115 int snd_info_init(void);
   111 int snd_info_done(void);
   116 int snd_info_done(void);
   112 
   117 
   113 int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len);
   118 int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len);
   114 char *snd_info_get_str(char *dest, char *src, int len);
   119 char *snd_info_get_str(char *dest, char *src, int len);
   115 struct snd_info_entry *snd_info_create_module_entry(struct module * module,
   120 struct snd_info_entry *snd_info_create_module_entry(struct module *module,
   116 					       const char *name,
   121 					       const char *name,
   117 					       struct snd_info_entry * parent);
   122 					       struct snd_info_entry *parent);
   118 struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card,
   123 struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
   119 					     const char *name,
   124 					     const char *name,
   120 					     struct snd_info_entry * parent);
   125 					     struct snd_info_entry *parent);
   121 void snd_info_free_entry(struct snd_info_entry * entry);
   126 void snd_info_free_entry(struct snd_info_entry *entry);
   122 int snd_info_store_text(struct snd_info_entry * entry);
   127 int snd_info_store_text(struct snd_info_entry *entry);
   123 int snd_info_restore_text(struct snd_info_entry * entry);
   128 int snd_info_restore_text(struct snd_info_entry *entry);
   124 
   129 
   125 int snd_info_card_create(struct snd_card * card);
   130 int snd_info_card_create(struct snd_card *card);
   126 int snd_info_card_register(struct snd_card * card);
   131 int snd_info_card_register(struct snd_card *card);
   127 int snd_info_card_free(struct snd_card * card);
   132 int snd_info_card_free(struct snd_card *card);
   128 void snd_info_card_disconnect(struct snd_card * card);
   133 void snd_info_card_disconnect(struct snd_card *card);
   129 int snd_info_register(struct snd_info_entry * entry);
   134 void snd_info_card_id_change(struct snd_card *card);
       
   135 int snd_info_register(struct snd_info_entry *entry);
   130 
   136 
   131 /* for card drivers */
   137 /* for card drivers */
   132 int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp);
   138 int snd_card_proc_new(struct snd_card *card, const char *name,
       
   139 		      struct snd_info_entry **entryp);
   133 
   140 
   134 static inline void snd_info_set_text_ops(struct snd_info_entry *entry, 
   141 static inline void snd_info_set_text_ops(struct snd_info_entry *entry, 
   135 					 void *private_data,
   142 	void *private_data,
   136 					 void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
   143 	void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
   137 {
   144 {
   138 	entry->private_data = private_data;
   145 	entry->private_data = private_data;
   139 	entry->c.text.read = read;
   146 	entry->c.text.read = read;
   140 }
   147 }
   141 
   148 
   144 #else
   151 #else
   145 
   152 
   146 #define snd_seq_root NULL
   153 #define snd_seq_root NULL
   147 #define snd_oss_root NULL
   154 #define snd_oss_root NULL
   148 
   155 
   149 static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; }
   156 static inline int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) { return 0; }
   150 static inline int snd_info_init(void) { return 0; }
   157 static inline int snd_info_init(void) { return 0; }
   151 static inline int snd_info_done(void) { return 0; }
   158 static inline int snd_info_done(void) { return 0; }
   152 
   159 
   153 static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; }
   160 static inline int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len) { return 0; }
   154 static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
   161 static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
   155 static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; }
   162 static inline struct snd_info_entry *snd_info_create_module_entry(struct module *module, const char *name, struct snd_info_entry *parent) { return NULL; }
   156 static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; }
   163 static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card, const char *name, struct snd_info_entry *parent) { return NULL; }
   157 static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; }
   164 static inline void snd_info_free_entry(struct snd_info_entry *entry) { ; }
   158 
   165 
   159 static inline int snd_info_card_create(struct snd_card * card) { return 0; }
   166 static inline int snd_info_card_create(struct snd_card *card) { return 0; }
   160 static inline int snd_info_card_register(struct snd_card * card) { return 0; }
   167 static inline int snd_info_card_register(struct snd_card *card) { return 0; }
   161 static inline int snd_info_card_free(struct snd_card * card) { return 0; }
   168 static inline int snd_info_card_free(struct snd_card *card) { return 0; }
   162 static inline void snd_info_card_disconnect(struct snd_card * card) { }
   169 static inline void snd_info_card_disconnect(struct snd_card *card) { }
   163 static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
   170 static inline void snd_info_card_id_change(struct snd_card *card) { }
       
   171 static inline int snd_info_register(struct snd_info_entry *entry) { return 0; }
   164 
   172 
   165 static inline int snd_card_proc_new(struct snd_card *card, const char *name,
   173 static inline int snd_card_proc_new(struct snd_card *card, const char *name,
   166 				    struct snd_info_entry **entryp) { return -EINVAL; }
   174 				    struct snd_info_entry **entryp) { return -EINVAL; }
   167 static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
   175 static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
   168 					 void *private_data,
   176 					 void *private_data,